As using the lib, I find out that schema with partial loading does not parse correctly to JSON schema. It still has required fields even though it should not. Here is the example test.
from marshmallow import Schema, fields
from marshmallow_jsonschema import JSONSchema
class UserSchema(Schema):
name = fields.String(required=True)
email = fields.String(required=True)
schema = UserSchema(partial=True)
assert schema.load({}) == {}
required_fields = JSONSchema().dump(schema)['definitions']['UserSchema']['required']
print(required_fields) # ['email', 'name']
assert required_fields == []
Expected results
The assertion test should run correctly.
Current results
required_fields has values email and name.
I'm happy to investigate and make PR to this issue.
Hi everyone,
Thank @fuhrysteve for this awesome lib.
As using the lib, I find out that schema with
partial loading
does not parse correctly to JSON schema. It still has required fields even though it should not. Here is the example test.Expected results
Current results
required_fields
has valuesemail
andname
.I'm happy to investigate and make PR to this issue.