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
We are using marshmallow-jsonschema to generate a JSON schema for json-editor.
I noticed that the recently introduced props_ordered argument does not work for nested schemas.
Extended Test Case:
deftest_sorting_properties():
classNestedTestSchema(Schema):
classMeta:
ordered=Truez=fields.Str()
y=fields.Str()
classTestSchema(Schema):
classMeta:
ordered=Trued=fields.Str()
c=fields.Str()
a=fields.Str()
l=fields.Nested(NestedTestSchema)
# Should be sorting of fieldsschema=TestSchema()
json_schema=JSONSchema()
dumped=json_schema.dump(schema)
data=dot_data_backwards_compatible(dumped)
sorted_keys=sorted(data["definitions"]["TestSchema"]["properties"].keys())
properties_names= [kforkinsorted_keys]
assertproperties_names== ["a", "c", "d", "l"]
sorted_keys=data["definitions"]["NestedTestSchema"]["properties"].keys()
properties_names= [kforkinsorted_keys]
assertproperties_names== ["y", "z"]
# Should be saving ordering of fieldsschema=TestSchema()
json_schema=JSONSchema(props_ordered=True)
dumped=json_schema.dump(schema)
data=dot_data_backwards_compatible(dumped)
keys=data["definitions"]["TestSchema"]["properties"].keys()
properties_names= [kforkinkeys]
assertproperties_names== ["d", "c", "a", "l"]
keys=data["definitions"]["NestedTestSchema"]["properties"].keys()
properties_names= [kforkinkeys]
# FIXME: Not orderedassertproperties_names== ["z", "y"]
The text was updated successfully, but these errors were encountered:
Hi everyone,
We are using marshmallow-jsonschema to generate a JSON schema for json-editor.
I noticed that the recently introduced
props_ordered
argument does not work for nested schemas.Extended Test Case:
The text was updated successfully, but these errors were encountered: