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

How to get Schema added to components/parameters? #890

Closed
lukaskoeller opened this issue Feb 29, 2024 · 5 comments
Closed

How to get Schema added to components/parameters? #890

lukaskoeller opened this issue Feb 29, 2024 · 5 comments

Comments

@lukaskoeller
Copy link

lukaskoeller commented Feb 29, 2024

I have the following setup:

from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from apispec_webframeworks.flask import FlaskPlugin

Schema

class FilterParams(Schema):
    month = fields.Int()
    quarter = fields.Int()
    scope_cat = fields.Str()
    scope_val = fields.Str()
    year = fields.Int()

Input

"""
# …
parameters:
    - FilterParams
"""

Output

"parameters": [
    {
        "$ref": "#/components/parameters/FilterParams"
    },

But it is actually not added to components/parameters. How can I fix this?

@lafrech
Copy link
Member

lafrech commented Feb 29, 2024 via email

@lukaskoeller
Copy link
Author

@lafrech Thanks for the quick answer. I tried that, it works, but the schema is then added to #/components/schemas not #/components/parameters

@lafrech
Copy link
Member

lafrech commented Feb 29, 2024 via email

@lukaskoeller
Copy link
Author

Yeah you got a point here! I'm still quite new and didn't image that it would not be possible. Will close on that behalf. Thank you very much!

@lukaskoeller
Copy link
Author

lukaskoeller commented Mar 1, 2024

For anybody interested, there is an eternally open PR to implement parameter grouping in openapi.

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

No branches or pull requests

2 participants