Skip to content
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

Add validation for hierarchy parent and children #4414

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

dgarros
Copy link
Collaborator

@dgarros dgarros commented Sep 21, 2024

Fixes #4325

Enforce the constraints defined in the schema that when a hierarchical node doesn't have a parent or children

@dgarros dgarros added the type/bug Something isn't working as expected label Sep 21, 2024
@github-actions github-actions bot added the group/backend Issue related to the backend (API Server, Git Agent) label Sep 21, 2024
@dgarros dgarros requested a review from a team September 21, 2024 17:03
Copy link
Contributor

@ajtmccarty ajtmccarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one small comment

@@ -1148,3 +1154,15 @@ async def to_graphql(
return None

return await relationships[0].to_graphql(fields=fields, db=db, related_node_ids=related_node_ids)

async def _validate_hierarchy(self) -> None:
if self.node._schema.is_profile_schema or not self.node._schema.hierarchy: # type: ignore[union-attr]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use node.get_schema in this method instead of accessing the _schema private variable

@dgarros dgarros force-pushed the dga-20240921-fix-4325 branch from 6558745 to 0e4cb63 Compare September 22, 2024 17:28
@dgarros dgarros merged commit 68c5d76 into stable Sep 23, 2024
31 checks passed
@dgarros dgarros deleted the dga-20240921-fix-4325 branch September 23, 2024 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
group/backend Issue related to the backend (API Server, Git Agent) type/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants