Skip to content

Investigate adding ability to edit specific values in an allowed values list #627

@joelvdavies

Description

@joelvdavies

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: float

The 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

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions