-
Notifications
You must be signed in to change notification settings - Fork 0
Description
This could be similar to the properties we define at the catalogue category level and would enable us to edit individual allowed values later using IDs. The main potential issue I can see is the current implementation of AllowedValues. It currently uses a discrimnatied union in pydantic, the idea being we can have different types of allowed value. The current one that needs the ability to edit being the list type, and so taking a list of values. The thought was that any future allowed values e.g. range type taking a mimum/maximum value would then be added e.g.
class AllowedValuesListSchema(BaseModel):
"""
Schema model representing a list of allowed values for a property defined within a catalogue category
"""
type: Literal["list"]
values: list[Any] = Field(description="Value within the allowed values list", min_length=1)
class AllowedValuesRange(BaseModel):
type: Literal["range"]
min: float
max: floatThe issue is that a POST endpoint to add more values, or a PATCH one to edit a specific value is tricker as the number of values varies. This could be solved using an array even in this case, but care would need to be taken over the POST as only the two values should exist. Not sure if there are any other cases of allowed values I can think of that could effect it though.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status