Skip to content

bug: Mutation RelationshipAdd and RelationshipRemove allows removing parent/child causing node to break. #5794

Description

@bilalabbad

Component

API Server / GraphQL

Infrahub version

latest

Current Behavior

Mutation RelationshipAdd and RelationshipRemove seems to do not have check on cardinality and optional.

For example:

with RelationshipAdd I can add more than 1 parent to a child node:
https://www.loom.com/share/f86b7fdbb65046cfa7dc64daafe75fb6

with RelationshipRemove I can remove a mandatory relationship parent/child:
https://www.loom.com/share/2171cfe583d348f796f7d2c807d1839e

Expected Behavior

RelationshipAdd and RelationshipRemove should respect every schema's defined constraint.

Steps to Reproduce

with RelationshipAdd I can add more than 1 parent to a child node:
https://www.loom.com/share/f86b7fdbb65046cfa7dc64daafe75fb6

with RelationshipRemove I can remove a mandatory relationship parent/child:
https://www.loom.com/share/2171cfe583d348f796f7d2c807d1839e

Additional Information

No response

Metadata

Metadata

Labels

group/backendIssue related to the backend (API Server, Git Agent)priority/2This issue stalls work on the project or its dependents, it's a blocker for a releasetype/bugSomething isn't working as expected

Type

Fields

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions