https://cerbos.dev logo
#help
Title
# help
n

Nimit Sarup

01/25/2024, 4:43 PM
hi . trying to understand application of schema (principal and resource) and struggling a little 🙂 Can you please point me to a simple example that illustrates this ? something that i can run in my local cerbos environment ? thanks
c

Charith (Cerbos)

01/25/2024, 6:18 PM
Basically the schemas are for defining the data types and required fields for the attributes of the principal and the resource. They are a way to add type safety to the Cerbos API requests because Cerbos ensures that the attributes sent in the API request conform to the schema. If the enforcement level is `reject`, any request that doesn't conform to the schema will get a DENY response from Cerbos. I couldn't find a public demo that had schemas so I made this playground instance: https://play.cerbos.dev/p/Vl4Y6165b2a220yOm0DAEUP0ZDGxa2J6. You can edit the principal or resource on the right hand side and try removing the required attributes or changing the data types to see that Cerbos rejects things when they don't conform to the schema.
🙌 1
n

Nimit Sarup

01/25/2024, 6:21 PM
thanks charith 🙂