| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
When using allOf with a reference to a base schema and then marking fields as required in a second schema, those fields are now correctly generated as required in the derived class. Properties inherited from referenced models are now updated to reflect required field overrides from the containing schema after all allOf schemas and their required fields are collected.
Add test_allof_required_override to verify that properties inherited from a base schema via allOf can be correctly marked as required in the derived schema's required list.
Add AllOfRequiredBase and AllOfRequiredDerived schemas to baseline specs to verify the generated code correctly handles required field overrides in allOf schemas. Update golden records accordingly.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes an issue where required field overrides in allOf schemas were being ignored when the base schema was referenced. Properties inherited from a base schema can now be correctly marked as required in derived schemas.
Problem
When using allOf with a reference to a base schema and then marking fields as required in a second schema, the generator was ignoring the required override. For example:
New behavior
A field will be required if it was marked required in the base schema or the derived schema. There is no way to remove a required restriction in a derived schema. This is because for a message to be valid under an allOf, it must be valid under all of the parent schemas.