Skip to content

Commit

Permalink
fixed fields_optional = '__all__'
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalik committed Dec 7, 2023
1 parent a96f654 commit 838e6ab
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_orm_metaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,20 @@ class Meta:
fields = "__all__"
fields_optional = "__all__"

assert OptSchema.json_schema().get("required") == ['extra']
assert OptSchema.json_schema().get("required") == ["extra"]
assert OptSchema.json_schema()["properties"] == {
'id': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'title': 'ID'},
'title': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Title'},
'other': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Other'},
'extra': {'title': 'Extra', 'type': 'integer'},
"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "ID"},
"title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Title"},
"other": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Other"},
"extra": {"title": "Extra", "type": "integer"},
}

assert OptSchema2.json_schema().get("required") is None
assert OptSchema2.json_schema()["properties"] == {
'id': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'title': 'ID'},
'title': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Title'},
'other': {'anyOf': [{'type': 'string'}, {'type': 'null'}], 'title': 'Other'},
'extra': {'anyOf': [{'type': 'integer'}, {'type': 'null'}], 'title': 'Extra'},
"id": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "ID"},
"title": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Title"},
"other": {"anyOf": [{"type": "string"}, {"type": "null"}], "title": "Other"},
"extra": {"anyOf": [{"type": "integer"}, {"type": "null"}], "title": "Extra"},
}


Expand Down

0 comments on commit 838e6ab

Please sign in to comment.