OpenAPITools / OpenAPITools/openapi-generator
[REQ][ELIXIR] Use Tesla.Middleware.PathParams instead of string interpolation for path parameters
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
The Elixir generator interpolates path parameters directly into the URL string ("/companies/#{company_id}"). This means Tesla.Middleware.PathParams is a no-op even when configured, and middleware that depends on it — like opentelemetry_tesla — can't see the original path template.
In practice, this breaks OpenTelemetry span naming: since opts[:path_params] is never set, all spans fall back to just the HTTP method (GET, POST), making traces useless for distinguishing routes.
Describe the solution you'd like
Use the original OpenAPI path with {param} placeholders and pass parameters via opts[:path_params], so PathParams middleware actually does the substitution.
Example
Before:
|> url("/companies/#{company_id}")
After:
|> url("/companies/{companyId}")
|> add_path_params([{"companyId", company_id}])
Describe alternatives you've considered
Using custom templates via -t, which works but requires maintaining a couple of custom templates.
Happy to submit a PR for this.
Additional context
Only works when used with Tesla.Middleware.PathParams only, so that would be added to connection.ex.mustache.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Elixir generator's connection.ex.mustache template and inspect how generated requests currently build URLs and pass options. Compare the generated client with Tesla.Middleware.PathParams expectations. Done means OpenAPI path placeholders and opts[:path_params] reach the middleware so route-specific tracing can use the original template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100