-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 field to OpenAPI output #5876
Conversation
@jefferai It looks like unique within a document is by far the most common interpretation, but there have been questions to the OAS group about tightening up what the operationId uniqueness scope is. There are likely cases where you would would the exact same definitions uniquely defined. To that end I've added an optional "context" parameter (naming improvements?), that the requester can provide which will be added to the generated ID. If this approach is OK, I'll update/add tests. |
logical/framework/openapi.go
Outdated
operationIDs[opID] += 1 | ||
opID = fmt.Sprintf("%s_%d", opID, n) | ||
} else { | ||
operationIDs[opID] = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be 1 instead? Otherwise the above += 1 will result in 3 for the next duplicate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's behaves as expected (since n
is used in the printf), but the code is awkward. I just pushed a change that simplifies it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just the one small comment
Fixes #5842