-
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 openapi response definitions to approle/path_role.go #18198
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.
a few questions but lgtm
Callback: b.pathRoleDelete, | ||
Responses: responseOK, |
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 like this returns nil, nil
vault/builtin/credential/approle/path_role.go
Line 1653 in e38b419
return nil, nil |
would the response be "ok" (200) or would it return 204 response code?
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.
You are right, it is returned as 204 for all nil, _ responses. Let me update it. Good catch 👍
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 think I had looked over most of it in your previous PR and I gave it another check and lgtm
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.
LGTM
This PR modifies the path schema of `approle/path_role.go`, switching the old `Callbacks` to the equivalent `Operations` objects with a list of response fields for the 200 responses. This will allow us to generate a response structures in openapi.json. This PR is split out from #18055 along with #18192. ### Example For `GET "/auth/approle/role/{role_name}/bind-secret-id"` path, it will update the response as follows: ```diff "responses": { "200": { "description": "OK", ++ "content": { ++ "application/json": { ++ "schema": { ++ "$ref": "#/components/schemas/ApproleRoleBindSecretIdResponse" ++ } ++ } } } } ``` And will add the actual response structure: ```diff ++ "ApproleRoleBindSecretIdResponse": { ++ "type": "object", ++ "properties": { ++ "bind_secret_id": { ++ "type": "boolean", ++ "description": "Impose secret_id to be presented when logging in using this role. Defaults to 'true'." ++ } ++ } ++ }, ```
This PR modifies the path schema of
approle/path_role.go
, switching the oldCallbacks
to the equivalentOperations
objects with a list of response fields for the 200 responses. This will allow us to generate a response structures in openapi.json. This PR is split out from #18055 along with #18192.Example
For
GET "/auth/approle/role/{role_name}/bind-secret-id"
path, it will update the response as follows:And will add the actual response structure: