@@ -164,19 +164,68 @@ Request tracing information by setting `with_tracing: true` in the request messa
164164
165165# ## Zed Validate
166166
167- Files exported from the [Playground](#playground) can also be validated by the `zed validate` command.
168- This is particularly useful for testing locally or checking into a CI/CD workflow.
169- If you're using GitHub, there's [GitHub Action][validate-action] for running this validation.
167+ The `zed` binary provides a means of validating and testing a schema locally and in CI :
170168
171- [validate-action] : # authzedaction-spicedb-validate
169+ ` ` ` sh
170+ zed validate my-schema.zed
171+ ` ` `
172+
173+ It will load and validate the schema using the same parsing logic that the SpiceDB binary uses,
174+ ensuring that a schema that passes validation will be considered a valid schema by your SpiceDB instance.
175+
176+ <Callout type="warning">
177+ Note that a schema write can still fail if a relation is removed and there are still instances of that
178+ relation in your database. `zed` doesn't know about your data.
179+ </Callout>
172180
173- Here's an example using `zed validate` :
181+ You can validate the functionality of your schema using validation yaml files, such as those exported
182+ by the [Playground](#playground):
174183
184+ ` ` ` sh
185+ zed validate schema-and-validations.yaml
175186` ` `
176- $ zed validate schema-and-assertions.yaml
177- Success! - 3 relationships loaded, 4 assertions run, 2 expected relations validated
187+
188+ Validation files take this form :
189+
190+ ` ` ` yaml
191+ schema: >-
192+ // schema goes here
193+ # -- OR --
194+ schemaFile: "./path/to/schema.zed"
195+
196+ # Note that relations are a single heredoc string rather than a yaml list
197+ relationships: >-
198+ object:foo#relation@subject:bar
199+ object:baz#relation@subject:qux
200+
201+ assertions:
202+ assertTrue:
203+ - object:foo#relation@subject:bar
204+ assertFalse:
205+ - object:foo#relation@subject:qux
206+ validation:
207+ object:foo#relation:
208+ - "[subject:bar] is <object:foo#user>"
178209` ` `
179210
211+ As of version v0.25.0, `zed validate` command can take multiple files as arguments :
212+
213+ ` ` `
214+ zed validate some-validations.yaml some-other-validations.yaml
215+ ` ` `
216+
217+ This means you can validate a folder full of files using shell globbing :
218+
219+ ` ` `
220+ zed validate validations/*
221+ ` ` `
222+
223+ There's an example of this available in the [examples repository](https://github.com/authzed/examples/tree/main/schemas/multiple-validation-files).
224+
225+ If you're using GitHub, there's a [GitHub Action][validate-action] for running this validation.
226+
227+ [validate-action] : # authzedaction-spicedb-validate
228+
180229# ## Explain Flag
181230
182231The `zed permission check` command has an optional flag, `--explain`, that will cause SpiceDB to collect the actual paths taken against the live system to compute a permission check.
0 commit comments