-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add support for Marshmallow Tuple field #399
Comments
Yes! Absolutely. Would you like to submit the change? |
This might be a bit trickier than I first thought.... I presume the first thing to do is to add to
But from reading the OpenAPI spec it doesn't seem to be possible to specify the types of the contained items individually. So I think the best we could do is to use
|
Since it may contain nested fields, it probably deserves a special treatment in there like There's been discussions in #172 about making this easier to extend, but for now, we can just add a case. |
How about adding an extension to indicate the order to the user. Maybe something like: {
"type": "array",
"items": {
"oneOf": [
{"type": "number"},
{"type": "string"}
]
},
"minItems": 2,
"maxItems": 2,
"x-order": [
{"type": "number"},
{"type": "string"}
],
} If there is enough of a use case we could look look to add something to the standard, but using an extension short term can help validate the use case. A couple other things I noted in playing around:
|
Tuples aren't supported by apispec yet marshmallow-code/apispec#399
Tuples aren't supported by apispec yet marshmallow-code/apispec#399
Info about representing tuple in OpenAPI:
I'd like a solution here that doesn't try to handle older OpenAPI versions. |
I couldn't really follow: Is there now a way to get Can anyone enlighten me? |
marshmallow 3.0.0rc4 adds a Tuple field. It would be nice if the apispec marshmallow plugin could support this.
The text was updated successfully, but these errors were encountered: