Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add operationId and tag to the generated spec #4

Open
ricardobeat opened this issue Feb 21, 2022 · 0 comments
Open

add operationId and tag to the generated spec #4

ricardobeat opened this issue Feb 21, 2022 · 0 comments

Comments

@ricardobeat
Copy link

I was testing out openapi-typescript-codegen which seems like a really good & fast option to create a typescript client, but found a major hurdle.

When generating clients from an OpenAPI spec, it's common to expose a service class with one method per endpoint. Usually you won't be able to create a class method containing the slashes in the request path (ex: api/buyer/get), so generators will use the optional operationId and tags fields to define method names.

For example, in hulk the /api/v1/buyer/create-buyer-branch could be assigned { tags: ["buyer"], operationId: "createBuyerBranch" } so the resulting client looks like:

hulk.buyer.createBuyerBranch({ ... })

Alternatively, an option to use the path itself as operationId in the output json would be enough to generate useful method names. I've opened an issue at ferdikoomen/openapi-typescript-codegen#973 suggesting this as the default behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant