Authzed schemas in CUE
# spicedb
v
Rewrote my Authzed schema in CUE (essentially an alternative to
zed preview schema compile
). This one file replaces all the other zed files in that directory (
_at.zed
is the previous schema compiled from all the resource.zed files) - https://github.com/blebbit/atproto/blob/main/packages/pds/src/authz/spicedb/schema/atproto.cue - https://github.com/blebbit/atproto/blob/main/packages/pds/src/authz/spicedb/schema/atcue.zed
I also wonder now, if I can represent the schema, relations, and checks in CUE. Maybe one day I'll give it the old college try
There's a ton of overlap in the algebra and logical engine for resolving correctness / access
The main benefit I got from writing in CUE is making edits to relation lists (like adding a subject or caveat). I only have to change one place, where in .zed files, I haven't found a way to build up more granular templates like having the
<resource>_<CRUD>
permissions >1000 lines down to < 300, easier to edit and try out variations
j
we've considered adding expansions in addition to the mixin support we have
v
yeah, repetition was a big reason to switch to CUE, templates and introspection are another, like the
#crud
helper
I turned all my Spice to CUE lol, couldn't help myself. I'll share after I cleanup and rework the readme