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

operationId #26

Open
okutyrin opened this issue May 10, 2019 · 3 comments
Open

operationId #26

okutyrin opened this issue May 10, 2019 · 3 comments

Comments

@okutyrin
Copy link

Is it possible to generate operationId as a part of OpenAPI definition? While it is optional from the POV of OpenAPI spec, some clients (https://github.com/swagger-api/swagger-js) rely on its existence.
Thanks!

@ralfhandl
Copy link
Contributor

@okutyrin It is possible, however https://github.com/swagger-api/swagger-js#tags-interface says that it can work without operationIds:

  • If an operationId is missing, we deduce it from the http method and path, i.e. ${method}${path}, with non-alphanumeric characters escaped to _. See these tests (1, 2) for examples.

I could do something similar, using $ as a separator character because it is not allowed in OData names and is allowed in JavaScript identifier names:

anEntitySet$$c
antEntitySet$$r
anEntitySet$$key$$r
anEntitySet$$key$$u
anEntitySet$$key$$d
anEntitySet$navProp$$r
anEntitySet$collectionNavProp$$c
anEntitySet$collectionNavProp$$r
anEntitySet$collectionNavProp$$key$$r
anEntitySet$collectionNavProp$$key$$u
anEntitySet$collectionNavProp$$key$$d
anEntitySet$collectionNavProp$$key$secondLevelNavProp$$r

etc.

Can you check whether that would work for your downstream tools?

Thanks in advance
Ralf

@okutyrin
Copy link
Author

can work without operationIds

Yes, in theory. But the way how they deduce operationIds out of existing tags results sometimes in ambiguous IDs, which is sort of bad ;)

Can you check whether that would work for your downstream tools?

Sure, will give it a try.

@ralfhandl
Copy link
Contributor

Hi @okutyrin,

The examples in branch operationid now have operationIds, see https://github.com/oasis-tcs/odata-openapi/tree/operationid/examples.

Can you please check whether that works for your client tools?

If it does, I will merge this into master.

Thanks in advance
Ralf

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

No branches or pull requests

2 participants