-
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 mount path into the default generated openapi.json spec (UI) #17926
Conversation
20e5cfd
to
a760ab7
Compare
2f5d20e
to
202efee
Compare
const pathInfo = help.openapi.paths[path]; | ||
const params = pathInfo.parameters; | ||
const paramProp = {}; | ||
|
||
// include url params | ||
if (params) { | ||
const { name, schema, description } = params[0]; |
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.
This is the crux of the change that fixes the UI issues. Before, we only cared about the first param for the path. Now that the backend mount path is also a path param, we instead iterate over all the path params, throw out _mount_path
(because we already capture it as backend
) and add the rest to the model
ui/app/services/path-help.js
Outdated
@@ -295,7 +299,8 @@ export default Service.extend({ | |||
}, | |||
|
|||
registerNewModelWithProps(helpUrl, backend, newModel, modelName) { | |||
return this.getProps(helpUrl, backend).then((props) => { | |||
const pathName = modelName === 'model:generated-user-userpass' ? '/users/{username}' : ''; |
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.
This might not actually be needed, checking now
Thank you for fixing the UI parts, @chelshaw! |
PR hashicorp#17926 already deleted the implementation of the `generic_mount_paths` field so it needs to be removed from the declared fields of the path too, so help and OpenAPI isn't misleading.
The current behaviour is to only add mount paths into the generated
opeanpi.json
spec if ageneric_mount_paths
flag is added to the request. This means that we would have to maintain two differentopenapi.json
files, which is not ideal. The new solution in this PR is to add{<mount>_mount_path}
into every path with a default value specified:Additionally, fixed the logic to generate the
operationId
(used to generate method names in the code generated from OpenAPI spec). It had a bug where the ID hadmountPath
in it.