Skip to content

feat: support permission type annotations (use typechecking)#21

Merged
josephschorr merged 1 commit into
mainfrom
support-permission-type-annotations
Jul 15, 2026
Merged

feat: support permission type annotations (use typechecking)#21
josephschorr merged 1 commit into
mainfrom
support-permission-type-annotations

Conversation

@josephschorr

Copy link
Copy Markdown
Member

Parse the optional return-type annotation on permissions (permission view: user | group = ...) introduced by the SpiceDB use typechecking flag. Previously any annotated permission failed to parse, which — in editor tooling — disabled go-to-definition and semantic highlighting for the entire schema.

  • dsl.ts: add an optional : type | type annotation to the permission grammar, restricted to plain type identifiers to match the SpiceDB parser. Expose it as ParsedPermission.annotatedTypes (a TypeExpr of TypeRefs) and walk it in findReferenceNode and mapParseNodes so go-to-definition resolves on annotation types.
  • resolution.ts: include annotation type refs in resolvedReferences() so they resolve and highlight like relation types.
  • Tests for the AST, the error cases mirrored from the SpiceDB parser fixtures, findReferenceNode, and the resolver.

Parse the optional return-type annotation on permissions
(`permission view: user | group = ...`) introduced by the SpiceDB
`use typechecking` flag. Previously any annotated permission failed to
parse, which — in editor tooling — disabled go-to-definition and
semantic highlighting for the entire schema.

- dsl.ts: add an optional `: type | type` annotation to the permission
  grammar, restricted to plain type identifiers to match the SpiceDB
  parser. Expose it as `ParsedPermission.annotatedTypes` (a TypeExpr of
  TypeRefs) and walk it in findReferenceNode and mapParseNodes so
  go-to-definition resolves on annotation types.
- resolution.ts: include annotation type refs in resolvedReferences()
  so they resolve and highlight like relation types.
- Tests for the AST, the error cases mirrored from the SpiceDB parser
  fixtures, findReferenceNode, and the resolver.
@josephschorr
josephschorr enabled auto-merge (squash) July 15, 2026 18:07
@josephschorr
josephschorr merged commit e6d8a91 into main Jul 15, 2026
4 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants