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 operation ids #135

Merged
merged 1 commit into from
Nov 8, 2016
Merged

add operation ids #135

merged 1 commit into from
Nov 8, 2016

Conversation

joprice
Copy link
Contributor

@joprice joprice commented Nov 6, 2016

To enable code generation, swagger provides the 'operationId' field. This is expected to be unique, as the documentation for this field states:

Unique string used to identify the operation. The id MUST be unique among all operations described in the API. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is recommended to follow common programming naming conventions.

However, according to some comments here OAI/OpenAPI-Specification#381, this is only meant to be unique per endpoint, which should work for most use cases.

However, since I'm only using the method name this would cause issues if two controllers are used with the same method in the same routes file:

# for now, PUT and POST have the same behavior
PUT    /users    controllers.Users.add
POST /users    controllers.Users.add

We may want validation for a use case like that. We could also allow customization via a function passed to the generator like operationId: Route => String

@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 90.942% when pulling 318b60d on joprice:operationIds into 8e377d3 on iheartradio:master.

@kailuowang
Copy link
Collaborator

👍

@joprice joprice merged commit 66bff89 into iheartradio:master Nov 8, 2016
@joprice joprice deleted the operationIds branch November 8, 2016 16:32
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

Successfully merging this pull request may close these issues.

3 participants