OpenAPITools / OpenAPITools/openapi-generator
[REQ][typescript-fetch] OperationId into middleware
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.
For internal logging purpose, we want to use the OperationID in our middleware.
Additionally, we imagine special treatment of custom middlewares, e.g. for responses to some login-operation in a logging or login-middleware
Describe the solution you'd like
- in
apis.mustache: add the operationId (nickname) as a parameter into the request context. - In
runtime.mustache: handle the new parameter inrequest()and the privatethis.fetchApi(). - Add the operationId as an (optional) additional parameter into
middleware.pre,middleware.postandmiddleware.onError
Describe alternatives you've considered
- One could use the path instead. That one is rather long and, using path parameters, not the best idea anyways. To match some backend operation / logging, this does not work nicely as well The OperationID is the best ID of the operation we have.
Additional context
- If the operationId is used optionally, there should not be any compatibility caveats
- It is an easy addition, we can provide a PR
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 in apis.mustache to trace how the request context is assembled, then follow request() and private this.fetchApi() in runtime.mustache. Add the optional operationId parameter through the request path and middleware.pre, middleware.post, and middleware.onError. Done means generated typescript-fetch clients expose the operation ID to middleware without compatibility issues when it is omitted.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100