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

openapi: Better mount points for kv-v1 and kv-v2 in openapi.json #21563

Merged
merged 6 commits into from Jul 5, 2023

Conversation

averche
Copy link
Contributor

@averche averche commented Jul 4, 2023

@maxb discovered an issue in hashicorp/vault-client-go#187 (comment) with the existing generated openapi.json: the generated mount path parameters for kv-v1 and kv-v2 are "kv" and "secret" respectively, which are not very intuitive when translated into generated code.

This PR fixes the issue by explicitly mounting kv-v1 at "kv-v1/" and kv-v2 and "kv-v2/" which results in proper mount paths in the generated opneapi.json:

cat scripts/openapi.json | jq -c '.paths | to_entries[] | .key as $key | .value | to_entries[] | select(.key == "get" or .key == "post" or .key == "list" or .key == "delete") | [$key, .key, .value.operationId]' | grep kv-v1
["/{kv_v1_mount_path}/{path}","get","kv-v1-read"]
["/{kv_v1_mount_path}/{path}","post","kv-v1-write"]
["/{kv_v1_mount_path}/{path}","delete","kv-v1-delete"]

cat scripts/openapi.json | jq -c '.paths | to_entries[] | .key as $key | .value | to_entries[] | select(.key == "get" or .key == "post" or .key == "list" or .key == "delete") | [$key, .key, .value.operationId]' | grep kv-v2
["/{kv_v2_mount_path}/config","get","kv-v2-read-configuration"]
["/{kv_v2_mount_path}/config","post","kv-v2-configure"]
["/{kv_v2_mount_path}/data/{path}","get","kv-v2-read"]
["/{kv_v2_mount_path}/data/{path}","post","kv-v2-write"]
["/{kv_v2_mount_path}/data/{path}","delete","kv-v2-delete"]
["/{kv_v2_mount_path}/delete/{path}","post","kv-v2-delete-versions"]
["/{kv_v2_mount_path}/destroy/{path}","post","kv-v2-destroy-versions"]
["/{kv_v2_mount_path}/metadata/{path}","get","kv-v2-read-metadata"]
["/{kv_v2_mount_path}/metadata/{path}","post","kv-v2-write-metadata"]
["/{kv_v2_mount_path}/metadata/{path}","delete","kv-v2-delete-metadata"]
["/{kv_v2_mount_path}/subkeys/{path}","get","kv-v2-read-subkeys"]
["/{kv_v2_mount_path}/undelete/{path}","post","kv-v2-undelete-versions"]

@averche averche added this to the 1.15 milestone Jul 4, 2023
@averche averche marked this pull request as ready for review July 4, 2023 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.14.x Backport changes to `release/1.14.x` core/openapi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants