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

Allow to pass parameters argument to path #453

Closed
karec opened this issue Jun 10, 2019 · 5 comments

Comments

@karec
Copy link
Contributor

commented Jun 10, 2019

The OpenAPI specifications allow to set parameters for a path item object https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#path-item-object to make them available for all operations.

AFAIK, APISpec.path() method doesn't take a parameters argument, resulting in duplicating documentation on every operation of the path for REST APIs.

If I've not missed a something here, I would be happy to work on a PR to add that feature

EDIT: details and spelling

@lafrech

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

Makes total sense to me.

PR welcome!

@karec

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

On it !

karec added a commit to karec/apispec that referenced this issue Jun 12, 2019

Add support for path level parameters marshmallow-code#453
* Create `clean_parameters` function to avoid duplicate code
* Extracted `get_ref` from `clean_operations` to reuse it in
  `clean_parameters`
* Added `parameters` argument to `APISpec.path()`
* Sending `parameters` argument to `plugin.path_helper` as a kwargs,
  allowing plugins to update it
* Added tests for global parameters feature
* Added tests for duplicate parameters in operations
* Added name to existing parameters in tests as required by OpenAPI
  specification
* Now raising an `APISpecError` in case of duplicate parameters in
  path / operations

karec added a commit to karec/apispec that referenced this issue Jun 12, 2019

Add support for path level parameters marshmallow-code#453
* Create `clean_parameters` function to avoid duplicate code
* Extracted `get_ref` from `clean_operations` to reuse it in
  `clean_parameters`
* Added `parameters` argument to `APISpec.path()`
* Sending `parameters` argument to `plugin.path_helper` as a kwargs,
  allowing plugins to update it
* Added tests for global parameters feature
* Added tests for duplicate parameters in operations
* Added name to existing parameters in tests as required by OpenAPI
  specification
* Now raising an `APISpecError` in case of duplicate parameters in
  path / operations
@lafrech

This comment has been minimized.

Copy link
Member

commented Jun 18, 2019

Closed by #455.

Thank you so much @karec for your work on this.

@lafrech lafrech closed this Jun 18, 2019

@lafrech

This comment has been minimized.

Copy link
Member

commented Jun 19, 2019

Should MarshmallowPlugin get a path_helper to allow passing schemas as path parameters?

Just wondering out loud. I don't see a practical use case.

@karec

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2019

Good question, I don't see a practical use case either, since we can still reference schema in our parameter object. Also, Parameter Object will require more than just a schema (name and in at least)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.