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

[Feature] Include Path.parameters in Operation.parameters #42

Closed
sergei-maertens opened this issue Sep 3, 2022 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sergei-maertens
Copy link
Contributor

What is a problem?

In

self.operation_builder.build(method, data[method.value])

only the operation.parameters is passed to the operation builder, while the OpenAPI spec also supports specifying parameters
at the path level that are shared by all operations for that path.

Considering that the method (under which an operation is keyed in the spec) is passed to the operation builder, it looks like the Operation instance is supposed to contain all information for itself, which should include the path parameters.

Describe the solution you'd like

Pass the extracted path parameters down to the operation builder, and have the operation builder do the resolution. Operations may override the path parameters according to the spec, but they cannot remove them. Note that a parameters is uniquely identified by the combination of name and location, so you can use those as dict keys for the override-behaviour check.

Describe alternatives you've considered

I can do the processing in my code of course, but ideally the code making use of openapi3-parser should not have to think about all the intricacies of the OpenAPI 3 specification.

Additional context

I'd like to be able to look at a single Operation instance and have all the necessary information at hand.

I'd also suggest including the URL path in the builder for that reason.

If you're open to this, then I can definitely submit a PR :-)

@sergei-maertens sergei-maertens added the enhancement New feature or request label Sep 3, 2022
@manchenkoff manchenkoff added this to the v1.2.0 milestone Sep 3, 2022
@manchenkoff
Copy link
Owner

@sergei-maertens feel free to open this PR 👍 but I guess these changes will break backward compatibility

@sergei-maertens
Copy link
Contributor Author

@sergei-maertens feel free to open this PR +1 but I guess these changes will break backward compatibility

I might have some time tonight, otherwise it'll probably be next weekend.

We could put the functionality behind a flag like in #40, and then in the next major release switch the default value disabled to enabled by default. What's your opinion on this approach?

@manchenkoff
Copy link
Owner

@sergei-maertens, sounds good to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants