https://cerbos.dev logo
Title
n

Nabil

10/12/2022, 6:51 PM
I've looked around a bit for answer to this but can find anything. Is there a reason why resource IDs have to be send to cerbos as a string?
A lot of our resource IDs are numbers and doing the conversion to a string when sending to cerbos isn't too big of an issue until we use a query plan because the filters returned that contain IDs return them as string and we have to reconvert them before using the filter
s

Steve High (NTWRK)

10/12/2022, 6:52 PM
I can't speak for Cerbos, but a string seems like the one universally accessible way to communicate an identifier. My org uses strings, uint64s and UUIDs for identifiers. Cerbos happily works with all of them
n

Nabil

10/12/2022, 6:53 PM
I mean don't get me wrong, I'd love for the datasources I'm working with to standardize on UUIDs, but I don't have a say in it 😄
c

Charith (Cerbos)

10/12/2022, 7:03 PM
Steve's got it right 100%. We can't dictate what data types Cerbos users have for identifiers but pretty much all of them should be easily convertible to be strings.
n

Nabil

10/12/2022, 7:07 PM
hmm I agree generally. It's only a problem for me when using cerbos query plans because you return an AST I then have to parse into filters. I'm using the
@cerbos/orm-prisma
module to generate these filters, but doing a second layer of conversion there is kind of clunky because the filter shape is determined by the policy conditions, not my source code
a

Alex Olivier (Cerbos)

10/12/2022, 8:33 PM
That’s an interesting case I hadn’t thought about. It maybe possible for the mapper to either provide a way to convert types or even introspect it from the prisms schema itself. How are you approaching it currently?