Forum Discussion
Hi arty13
I'm not familiar with the Marshmellow enough to comment on that side, but for the OpenAPI side it sounds like you're after a groups of $refs which isn't support in OpenAPI yet (unfortunately, I think it's an important feature too). You can track the spec issue here https://github.com/OAI/OpenAPI-Specification/issues/445 (it's old, but you can ping to get it to the attention of the OpenAPI spec team which meets weekly).
Not many workarounds exist.
You could write a script to inject a bunch of $refs, something that would create the following:
parameters:
- $ref: '#/components/parameters/One'
- $ref: '#/components/parameters/Two'
- $ref: '#/components/parameters/N'
# etc...
components:
parameters:
One:
name: one
in: query
schema:
type: string
# etc...
We're also looking to address this with a new side-spec called Overlays (https://github.com/OAI/Overlay-Specification/) which would be a standard way of defining mutations to a base definition.
At this rate there may be a way of doing this with Marshmellow (to inject all those parameters), perhaps reach out to the Marshmellow team and/or GitHub issues there? Feel free to link to this issue if it helps.
It was an issue on my side as I did not need to specify the `ref` part pointing to my schema.
Details can be found here:
https://github.com/marshmallow-code/apispec/issues/732
Related Content
- 4 years ago