-
Notifications
You must be signed in to change notification settings - Fork 323
Implement the "use typechecking" directive, annotating the source, and checking against the schema if the types are present #2457
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
base: main
Are you sure you want to change the base?
Conversation
|
||
permission view: user = viewer | ||
permission edit: user = viewer | ||
permission admin: group = viewer |
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.
Add additional tests for error cases:
:
but no type before the=
: something |
: |
} | ||
|
||
// Find existing PERMISSION RelationMetadata and update it, or create new one | ||
for i, metadataAny := range relation.Metadata.MetadataMessage { |
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.
Move this logic into https://github.com/authzed/spicedb/blob/main/pkg/namespace/metadata.go and follow a similar style to there
@@ -77,6 +77,7 @@ message RelationMetadata { | |||
} | |||
|
|||
RelationKind kind = 1; | |||
repeated string type_annotations = 2; |
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.
Put this under a TypeAnnotations message so we can change it in the future if we want
@@ -103,6 +106,24 @@ func translate(tctx *translationContext, root *dslNode) (*CompiledSchema, error) | |||
|
|||
// Check for typechecking after all definitions are processed. | |||
if slices.Contains(tctx.enabledFlags, "typechecking") { | |||
resolver := ResolverForCompiledSchema(compiledSchema) | |||
ts := schema.NewTypeSystem(resolver) |
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.
This should be done as part of the .Validate
call on the type system, rather than the schema translator
No description provided.