-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
_flag:stale[BOT ONLY] Flag issue that hasn't been updated in a while and needs to be triaged again[BOT ONLY] Flag issue that hasn't been updated in a while and needs to be triaged againrefactorSimplifying or restructuring existing code or documentation.Simplifying or restructuring existing code or documentation.
Description
In our data models, several fields/parameters that accept lists are defined with a default value of None, e.g.:
federation-api/app/api/models.py
Lines 49 to 53 in 485b33d
| class NodeDatasets(BaseModel): | |
| """Data model for specifying datasets to query within a specific node.""" | |
| node_url: str | |
| dataset_uuids: list[str] | None = None |
When these fields are optional, it means that the API will have the following parsing behaviour:
- A request where this field isn't included at all (undefined) -->
dataset_uuids=None "dataset_uuids": null->dataset_uuids=None"dataset_uuids": []-->dataset_uuids=[]
Right now we treat [] and None the same way for these fields, but the fact that what's considered an empty value can be ambiguous is probably not ideal. A better practice may be to default to an empty list [] so that null values are disallowed, so that we avoid having to guess in the future if the field is [] or None.
Metadata
Metadata
Assignees
Labels
_flag:stale[BOT ONLY] Flag issue that hasn't been updated in a while and needs to be triaged again[BOT ONLY] Flag issue that hasn't been updated in a while and needs to be triaged againrefactorSimplifying or restructuring existing code or documentation.Simplifying or restructuring existing code or documentation.
Type
Projects
Status
No status