fix: populate path_params when importing OpenAPI specs#355
Open
WeiMengze666 wants to merge 1 commit into
Open
Conversation
|
Just to be consistent and transparent - this should also be applied/automated for QueryParams which are also hidden/ignored at the URL field. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When importing an OpenAPI spec, path parameters (e.g.
{id}in/example/{id}) were silently ignored:{param}syntax instead of beingconverted to posting's
:paramsyntax.path_paramson the imported request was always empty, so pathparameters could not be edited or substituted in the UI.
were not read at all — only operation-level parameters were processed.
This affected both inline parameters and
$refparameters, and bothOpenAPI 3.0.x and 3.1.x specs.
Changes
{param}→:paramin the URL when building eachRequestModelduring import.spec: operation-level parameters override path-item parameters with
the same
(name, in)combination.request.path_paramsfrom parameters within: path.Testing
Five new tests added to
tests/test_open_api_import.py:test_import_inline_path_params— inline path params mixed withquery params, OpenAPI 3.1
test_import_ref_path_params—$refpath params, OpenAPI 3.1(the exact scenario from Can't use query parameters as References in path endpoints #292)
test_import_path_params_openapi_30— inline path params,OpenAPI 3.0.x
test_import_path_item_level_params— path-item level params mergedwith operation-level params
test_import_path_item_params_operation_overrides— operation-levelparam overrides path-item param with same
(name, in)Fixes #292