You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When converting a nullable Raw Marshmallow field into its corresponding OpenAPI representation for OAS 3.1.0, the generated representation does not match the behaviour of the actual schema/field:
It appears the FieldConverterMixin's field2nullable is appending null to the list of supported types for OAS 3.1.0, which makes sense in many cases, but when there's no pre-existing type value defined, the result is just ['null'], which means that the field can only be null. This doesn't match the behaviour of the defined schema.
I've implemented a workaround for this where I've overridden the DEFAULT_FIELD_MAPPING for marshmallow.fields.Raw to map to all supported JSON types (["boolean", "object", "array", "number", "string"]), but it's a bit of a hack, and would be nice if the library could support this a bit better.
The text was updated successfully, but these errors were encountered:
When converting a nullable
Raw
Marshmallow field into its corresponding OpenAPI representation for OAS 3.1.0, the generated representation does not match the behaviour of the actual schema/field:The output of printing the
json_schema
variable above is the following:It appears the
FieldConverterMixin
'sfield2nullable
is appendingnull
to the list of supported types for OAS 3.1.0, which makes sense in many cases, but when there's no pre-existingtype
value defined, the result is just['null']
, which means that the field can only benull
. This doesn't match the behaviour of the defined schema.I've implemented a workaround for this where I've overridden the
DEFAULT_FIELD_MAPPING
formarshmallow.fields.Raw
to map to all supported JSON types (["boolean", "object", "array", "number", "string"]
), but it's a bit of a hack, and would be nice if the library could support this a bit better.The text was updated successfully, but these errors were encountered: