-
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
openapi: Improve operationId/request/response naming strategy #19319
Conversation
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.
I looked at the test, but could we get examples in the description of what the new OperationId's will map to that are actual paths right now? E.g. PostAuthApproleRoleRoleName
will now look like... ?
After this PR is merged, the names are not going to be in an ideal form. For instance, The follow-up PR(s) will populate the |
There are quite a few cases where there is an auth method and a secrets engine of the same name (e.g AWS, Azure, Kubernetes, LDAP). For this reason, I think it might be better to retain the |
My plan is to address such ambiguities in related PR's by adding "Auth" into the |
This reverts commit 7aacc2c.
Please see #19319 for more details on how this will affect the generated OpenAPI schema. ___ The following OperationID's will be generated for Nomad plugin: nomad-read-access-configuration nomad-configure-access nomad-delete-access-configuration nomad-read-lease-configuration nomad-configure-lease nomad-delete-lease-configuration nomad-generate-credentials nomad-list-roles nomad-read-role nomad-write-role nomad-delete-role
Please see #19319 for more details on how this will affect the generated OpenAPI schema. ____ ### The following OperationID's will be generated for GitHub auth: github-read-configuration github-configure github-log-in github-read-teams github-read-team-mapping github-write-team-mapping github-delete-team-mapping github-read-users github-read-user-mapping github-write-user-mapping github-delete-user-mapping
Background
This PR changes the way we construct the
operationId
as well as the request & response names in the generatedopenapi.json
document.operationId
s are translated directly into method names in the two new OpenAPI-based client libraries:Old naming strategy
Today the approach is to naively construct
operationId
values from the API paths. Unfortunately, the resultant methods names are not very human-friendly. Here are a couple examples:Additionally, the request & response names had a different naming logic, which resulted in some naming collisions (#18578).
New naming strategy
The new naming strategy is to take advantage of the existing optional
DisplayAttributes
at Path and PathOperation level. I'm introducing a couple newDisplayAttributes
fields:vault/sdk/framework/path.go
Lines 227 to 243 in 72c4acd
These fields will be used to help construct the operation ID / request / response names if defined. The fields will now be generated as
hyphenated-lowercase-strings
for better compatibility with various language generators.For examples of how the new naming strategy works, please take a look at the new test:
vault/sdk/framework/openapi_test.go
Lines 571 to 744 in 72c4acd
Related work
This PR is a new approach based on some valid concerns brought forward by @maxb in a related #18321.
The changes to define display attributes for specific plugins will be done in upcoming related PRs: