-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEAT-28] Extend DMS rules to lists #272
Conversation
index: StrListType | None = Field(None, alias="Index") | ||
constraint: StrListType | None = Field(None, alias="Constraint") | ||
|
||
@field_validator("value_type", mode="before") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this could not fit under _types.py
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is only used here, which is why I do not put it into the types.
return ViewEntity.from_raw(value) | ||
return value | ||
|
||
@field_serializer("value_type", when_used="unless-none") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same argument
|
||
|
||
class DMSContainer(SheetEntity): | ||
class_: str | None = Field(None, alias="Class") | ||
container: ContainerType = Field(alias="Container") | ||
description: str | None = Field(None, alias="Description") | ||
constraint: ContainerType | None = Field(None, alias="Constraint") | ||
constraint: ContainerListType | None = Field(None, alias="Constraint") | ||
|
||
def as_container(self, default_space: str) -> dm.ContainerApply: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
@@ -50,7 +51,7 @@ def rules_schema_tests_cases() -> Iterable[ParameterSet]: | |||
DMSProperty( | |||
class_="WindFarm", | |||
property_="WindTurbines", | |||
value_type="WindTurbine", | |||
value_type=ViewEntity(suffix="WindTurbine"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a before
validation that auto-create ViewEntity if only string is passed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Three changes to better cover all DMS possibilities:
ViewEntity
if the relation column is set. This means we now support referring to views which are in a different space than the default set in the metadata sheet, and an arbitrary version.The next are more esoteric, less important, but gives us a better cover of DMS rules