Skip to content

Revisit default values for list query parameters/fields #198

@alyssadai

Description

@alyssadai

In our data models, several fields/parameters that accept lists are defined with a default value of None, e.g.:

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

No one assigned

    Labels

    _flag:stale[BOT ONLY] Flag issue that hasn't been updated in a while and needs to be triaged againrefactorSimplifying or restructuring existing code or documentation.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions