-
Notifications
You must be signed in to change notification settings - Fork 20
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
Loading a schema with an incorrect order_by field raise a proper error #4427
Conversation
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.
all look good, just one question on an updated test
@@ -1226,7 +1233,6 @@ async def test_validate_display_labels_error(schema_all_in_one, display_labels, | |||
["my_generic_name__value", "mybool__value"], | |||
["my_generic_name__value"], | |||
["primary_tag__name__value"], | |||
["status__name__value", "mybool__value"], |
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.
did this one start to fail? it seems like it should still be allowed
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 it failed because Status
is an optional relationship of GenericInterface
. Not sure what is the expected behavior here, this pattern is currently not supported by uniqueness_constraints
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.
As discussed, order_by
should support optional cardinality-one relationship
@@ -523,6 +523,30 @@ def generate_identifiers(self) -> None: | |||
rel.identifier = str("__".join(sorted([node.kind, rel.peer]))).lower() | |||
self.set(name=name, schema=node) | |||
|
|||
@staticmethod | |||
def validate_attr_or_mandatory_rel_path( | |||
schema_path: SchemaAttributePath, node_schema: MainSchemaTypes, element_name: str, element_path: str |
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.
Have you considered using the function SchemaBranch.validate_schema_path
here ? it has been designed specifically so you can provide the criteria using flags
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, but some criteria seem to be significantly specific to certain fields. For instance, uniqueness_constraints
raises on optional relationship while order_by
should not, so it might be relevant to have specific logic in dedicated functions
Also, would be good to add a newsfragment for the changelog |
ec80aac
to
1e2ad37
Compare
1e2ad37
to
f60b4b5
Compare
768db23
to
3667c0f
Compare
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.
big improvements all around
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.
Great work @LucasG0
8a85590
to
834724b
Compare
834724b
to
f1ce2f6
Compare
No description provided.