You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are hardcoding contractual items in a place that is a bit difficult to discover. We can gain a lot of observability and more easily test that these items are not changed or removed by implementing something on the class level.
A simple implementation is just a contractual: bool = True on the class or field, but there might be some other way of accomplishing this that is more durable against changes, i.e., this variable doesn't add "real" protection against a committed change aside from the marking being there.
This also means we could populate the list of contractual items automatically rather than trying to remember to keep the list up-to-date.
This requires a bit of research as to the best way to do it, since some classes represent a single field, or in same cases a single field within a class is contractual.
= Field(exclude=True) will keep it out of the schema.
The text was updated successfully, but these errors were encountered:
mferrera
changed the title
Make contractual schema items a Pydantic class variable
Make contractual schema items a Pydantic class/field value
Sep 27, 2024
As a workaround for testing, can just pull the contractual list out so it can be accessed separately and added in as a constant list defined somewhere (i.e. definitions.py)
We are hardcoding contractual items in a place that is a bit difficult to discover. We can gain a lot of observability and more easily test that these items are not changed or removed by implementing something on the class level.
A simple implementation is just a
contractual: bool = True
on the class or field, but there might be some other way of accomplishing this that is more durable against changes, i.e., this variable doesn't add "real" protection against a committed change aside from the marking being there.This also means we could populate the list of contractual items automatically rather than trying to remember to keep the list up-to-date.
fmu-dataio/src/fmu/dataio/_model/root.py
Lines 247 to 289 in c34f6dd
This requires a bit of research as to the best way to do it, since some classes represent a single field, or in same cases a single field within a class is contractual.
= Field(exclude=True)
will keep it out of the schema.The text was updated successfully, but these errors were encountered: