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

Fix relation validation #118

Merged
merged 2 commits into from
Jun 20, 2023
Merged

Conversation

mikemrm
Copy link
Contributor

@mikemrm mikemrm commented Jun 20, 2023

Previously we were checking if the destination resource had a relation
rather than the targeted resource having a relation to the destination.

This resulted in the following not working:

resourcetypes:
  - name: folder
    relationships:
      - relation: parent
        targettypenames:
          - folder
  - name: file
    relationships:
      - relation: parent
        targettypenames:
          - folder

When creating a relationship previously, relating a folder to a parent
folder would work since they happen to have the same resource type.
However relating a file to a parent folder would fail due to us checking
if folder has a parent relationship type name for file.

Previously we were checking if the destination resource had a relation
rather than the targeted resource having a relation to the destination.

This resulted in the following not working:

```yaml
resourcetypes:
  - name: folder
    relationships:
      - relation: parent
        targettypenames:
          - folder
  - name: file
    relationships:
      - relation: parent
        targettypenames:
          - folder
```

When creating a relationship previously, relating a folder to a parent
folder would work since they happen to have the same resource type.
However relating a file to a parent folder would fail due to us checking
if folder has a parent relationship type name for file.

Signed-off-by: Mike Mason <[email protected]>
@mikemrm mikemrm marked this pull request as ready for review June 20, 2023 13:34
@mikemrm mikemrm requested review from a team as code owners June 20, 2023 13:34
@mikemrm mikemrm merged commit f8be5d1 into infratographer:main Jun 20, 2023
@mikemrm mikemrm deleted the fix-relation-validation branch June 20, 2023 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants