The EDR OpenAPI schema identifies some elements as required and/or nullable
We haven't been particularly rigorous in adhering to these restrictions in our initial implementation.
The implications for the core.models data models:
- it should be possible to set nullable values to
None
- values for optional fields should default to
None if not explicitly set
- values that are not allowed to be nullable should be always set, either by an explicit argument or sensible default
The implications for serialisation are:
- when encoding nullable fields (both optional and required),
None values are serialised as JSON null values
- when encoding non-nullable, optional fields, the field is omitted from the output if the value is
None
- non-nullable, required fields set to
None would be an error, and ought not to be possible if our core.models are correctly implemented
I believe the possible options are something like
|
nullable=False |
nullable=True |
| required=True |
None not allowed in data models; always included in serialisation |
None allowed in data models; always included in serialisation |
| required=False |
None allowed in data models; not included in serialisation if set to None |
None allowed in data models; Element omitted from serialisation if set to None |
The EDR OpenAPI schema identifies some elements as required and/or nullable
We haven't been particularly rigorous in adhering to these restrictions in our initial implementation.
The implications for the
core.modelsdata models:NoneNoneif not explicitly setThe implications for serialisation are:
Nonevalues are serialised as JSONnullvaluesNoneNonewould be an error, and ought not to be possible if ourcore.modelsare correctly implementedI believe the possible options are something like
Nonenot allowed in data models; always included in serialisationNoneallowed in data models; always included in serialisationNoneallowed in data models; not included in serialisation if set toNoneNoneallowed in data models; Element omitted from serialisation if set toNone