Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

always the same model and sample when operationId is not specified #92

Closed
panlina opened this issue Aug 22, 2018 · 3 comments
Closed

always the same model and sample when operationId is not specified #92

panlina opened this issue Aug 22, 2018 · 3 comments

Comments

@panlina
Copy link

panlina commented Aug 22, 2018

I do not have operationId in every OperationObject since it's not required. When I expand an operation after another, the model and sample value displayed are of the previous operation. This happens for all of the operations I expanded later. All of them display the same model and sample value.
I find it's because it uses operationId in the key of model and sample collection:

var id = operation.operationId + '-' + section;

var id = operation.operationId + '-' + section;

So when operationId is not specified, id will start with "undefined", all operations in the same section will share the same key, and no new model and sample value will be generated.

@panlina
Copy link
Author

panlina commented Aug 22, 2018

Maybe we can concatenate method and path as a key when operationId is not defined? And why section is necessary?

@mathieuales
Copy link
Collaborator

All generators i've tested generate an operationId for all operations. As described in spec lots of tools use this attribute as unique identifier for operations so i think it is highly recommended to define one.
I take your point into account and will think about a fix in further version.
Regards

@panlina
Copy link
Author

panlina commented Aug 22, 2018

Do you mean those tools that generates the spec from java source code with annotations? It's true that people don't have to worry about operationId in this case, but for those who author a spec separately, the operationId is somewhat redundant because most operations in a restful service are already well identified by its method, url and parameters thus no need to give it another camelCased name. So I think it's pleasant to allow people omit this property.
Thank you for taking this into account.

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

No branches or pull requests

2 participants