Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Openapi 3.0.X support for shcemas in paramters in marshmallow extension #217
Currently, marshmallow extension only partially supports openapi 3.0.X . In my case, I would like to assign marshmallow schema object in parameters.
The code below is a demonstration for my case.
from marshmallow import Schema, fields class PetSchema(Schema): id = fields.Int(dump_only=True) name = fields.Str() age = fields.Int() def pet_view(): """Not much to see here. --- get: parameters: - in: query schema: PetSchema """ return '...'
The expected result in Openapi Specification 3.0.X is as below:
get: parameters: - in: query name: name required: false schema: type: string - in: query name: age required: false schema: format: int32 type: integer
In short, format and type field must be inside schema object. A parameter object do not allow format field nor type field.
However, current result is as follow:
get: parameters: - in: query name: name required: false type: string - in: query name: age required: false format: int32 type: integer
Thus, I modify the code to fix this behavior. Also, I notice that collectionFormat field is now deprecated in Openapi 3.0.X . Instead, an equivalent of collection set to multi is that style set to form, with explode set to true.
name: id in: query description: ID of the object to fetch required: false schema: type: array items: type: string style: form explode: true