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 not unique #23

Closed
barnaclebarnes opened this issue Jun 26, 2018 · 6 comments
Closed

operationID not unique #23

barnaclebarnes opened this issue Jun 26, 2018 · 6 comments

Comments

@barnaclebarnes
Copy link

The operationId being output is currently the action name of the controller. According to the docs:

"operationId: string - 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."

As multiple controllers may have index, show methods, etc. then this outputs duplicate operationID's. It would be good if:

  1. The default was #{controller_name}_#{action}
  2. You could set this in the api call
@barnaclebarnes
Copy link
Author

I realised I can do self[:operationId] = "show_app" in the api block so no need for number 2 on that list. 1 though should default to creating a unique name.

@zhandao
Copy link
Owner

zhandao commented Jun 26, 2018

You're right, I will consider that.

@zhandao
Copy link
Owner

zhandao commented Jun 26, 2018

Hi, I updated the changes.
Number 1 became the default, and you can do number 2 by the param keyword id of the api method, like: api :index, id: :show_all, ...

Thanks you.

@barnaclebarnes
Copy link
Author

@zhandao Thanks for that. I would potentially make it like this to make it bit nicer to read:

# ControllerNameAction
"#{@doc_info[:tag][:name]}#{action.capitalize}"

Not a critical though.

@zhandao
Copy link
Owner

zhandao commented Jun 27, 2018

OK, I'll make that in next commit.

@zhandao
Copy link
Owner

zhandao commented Jul 19, 2018

Done.

@zhandao zhandao closed this as completed Jul 19, 2018
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

2 participants