Nullable fields should be rendered as "type": ["fieldType", "null"], not ["fieldType", "'null'"].
The field converter currently includes quotes around null in the literal string value, see
|
attributes["type"] = make_type_list(ret.get("type")) + ["'null'"] |
which results in JSON like this:
"created_at": {
"type": [
"string",
"'null'"
],
"format": "date-time",
"readOnly": true
},
or as YAML:
created_at:
type:
- string
- '''null'''
format: date-time
readOnly: true
While the type string should be a string (and not None in Python, null in JSON or YAML), the extra quotes there are an error.
To fix, please drop the extra quotes in the value:
attributes["type"] = make_type_list(ret.get("type")) + ["null"]
Also see
Nullable fields should be rendered as
"type": ["fieldType", "null"], not["fieldType", "'null'"].The field converter currently includes quotes around
nullin the literal string value, seeapispec/src/apispec/ext/marshmallow/field_converter.py
Line 283 in 5cf763e
which results in JSON like this:
or as YAML:
While the type string should be a string (and not
Nonein Python,nullin JSON or YAML), the extra quotes there are an error.To fix, please drop the extra quotes in the value:
Also see