Skip to content

Commit

Permalink
Merge pull request #2062 from josephschorr/arrow-relation-ref
Browse files Browse the repository at this point in the history
Remove warning for an arrow referencing a relation in its own namespace
  • Loading branch information
josephschorr authored Sep 16, 2024
2 parents d9162eb + e3d58d7 commit de6c2e8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/development/warningdefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ var lintArrowReferencingRelation = ttuCheck{
}

for _, subjectType := range allowedSubjectTypes {
// Skip for arrow referencing relations in the same namespace.
if subjectType.Namespace == ts.Namespace().Name {
continue
}

nts, err := ts.TypeSystemForNamespace(ctx, subjectType.Namespace)
if err != nil {
return nil, err
Expand Down
12 changes: 12 additions & 0 deletions pkg/development/warnings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ func TestWarnings(t *testing.T) {
SourceCode: "view",
},
},
{
name: "arrow referencing relation in the same namespace",
schema: `definition user {}
definition document {
relation parent: document
relation viewer: user
permission view = parent->viewer
}
`,
expectedWarning: nil,
},
}

for _, tc := range tcs {
Expand Down

0 comments on commit de6c2e8

Please sign in to comment.