Skip to content

Validate StatementParameters #309

@SergioSim

Description

@SergioSim

Feature Request

Is your feature request related to a problem or unsupported use case? Please describe.
The StatementParameters class was defined as a dataclass to avoid double validation as it was intended to be populated with fields already validated by FastAPI.
However, if it's used in a context outside of the LRS, (e.g. library usage) - no validation is applied which is undesirable.

Describe the solution you'd like
We would like to replace the StatementsParameters dataclass with a StatementsParameters pydantic model to ensure field validation.
We could use the pydantic construct() method in our LRS API to avoid double validation.

Describe alternatives you've considered
We could support both (dataclass and pydantic model), however, this would be redundant as in both contexts (LRS/library usage) a pydantic model could achieve the objective.

Discovery, Documentation, Adoption, Migration Strategy
The change should be backward compatible.

Do you want to work on it through a Pull Request?
This change is included in the backends unification pull request. #228

Thanks to @jmaupetit for spotting this issue and providing the solution)

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions