-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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
Noneif 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),
Nonevalues are serialised as JSONnullvalues - when encoding non-nullable, optional fields, the field is omitted from the output if the value is
None - non-nullable, required fields set to
Nonewould be an error, and ought not to be possible if ourcore.modelsare 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 |
Metadata
Metadata
Assignees
Labels
No labels