Skip to content

Commit 61d20f9

Browse files
docs: Add comprehensive store file format documentation (#518)
* docs: add comprehensive store file format documentation * docs: enhance STORE_FILE.md with condensed users/objects feature examples --------- Co-authored-by: Raghd Hamzeh <raghd@rhamzeh.com>
1 parent 9dde080 commit 61d20f9

2 files changed

Lines changed: 473 additions & 32 deletions

File tree

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export FGA_STORE_ID=$(fga store create --model model.fga | jq -r .store.id)
228228
fga store **import**
229229

230230
###### Parameters
231-
* `--file`: File containing the store.
231+
* `--file`: File containing the store. See [Store File Format](docs/STORE_FILE.md) for detailed documentation.
232232
* `--store-id`: Specifies the store id to import into
233233
* `--max-tuples-per-write`: Max tuples to send in a single write (optional, default=1)
234234
* `--max-parallel-requests`: Max requests to send in parallel (optional, default=4)
@@ -541,7 +541,7 @@ fga model **test**
541541

542542
###### Parameters
543543

544-
* `--tests`: Name of the tests file. Must be in yaml format (see below)
544+
* `--tests`: Name of the tests file. Must be in yaml format. See [Store File Format](docs/STORE_FILE.md) for detailed documentation.
545545
* `--verbose`: Outputs the results in JSON
546546

547547
If a model is provided, the test will run in a built-in OpenFGA instance (you do not need a separate server). Otherwise, the test will be run against the configured store of your OpenFGA instance. When running against a remote instance, the tuples will be sent as contextual tuples, and will have to abide by the OpenFGA server limits (20 contextual tuples per request).
@@ -574,35 +574,35 @@ tests: # required
574574
- name: test-1
575575
description: testing that the model works # optional
576576
# tuple_file: ./tuples.json # tuples that would apply per test
577-
tuples:
578-
- user: user:anne
579-
relation: owner
580-
object: folder:1
581-
check: # a set of checks to run
582-
- user: user:anne
583-
object: folder:1
584-
assertions:
585-
# a set of expected results for each relation
586-
can_view: true
587-
can_write: true
588-
can_share: false
589-
# checks can group multiple users that share the same expected results
590-
- object: folder:2
591-
users:
592-
- user:beth
593-
- user:carl
594-
assertions:
595-
can_view: false
596-
# checks can group multiple objects that share the same expected results
597-
- objects:
598-
- folder:1
599-
- folder:2
600-
user: user:beth
601-
assertions:
602-
can_write: false
603-
# either "user" or "users" may be provided, but not both
604-
# either "object" or "objects" may be provided, but not both
605-
list_objects: # a set of list objects to run
577+
tuples:
578+
- user: user:anne
579+
relation: owner
580+
object: folder:1
581+
check: # a set of checks to run
582+
- user: user:anne
583+
object: folder:1
584+
assertions:
585+
# a set of expected results for each relation
586+
can_view: true
587+
can_write: true
588+
can_share: false
589+
# checks can group multiple users that share the same expected results
590+
- object: folder:2
591+
users:
592+
- user:beth
593+
- user:carl
594+
assertions:
595+
can_view: false
596+
# checks can group multiple objects that share the same expected results
597+
- objects:
598+
- folder:1
599+
- folder:2
600+
user: user:beth
601+
assertions:
602+
can_write: false
603+
# either "user" or "users" may be provided, but not both
604+
# either "object" or "objects" may be provided, but not both
605+
list_objects: # a set of list objects to run
606606
- user: user:anne
607607
type: folder
608608
assertions:
@@ -638,7 +638,7 @@ tests: # required
638638
###### Example
639639
`fga model test --tests tests.fga.yaml`
640640

641-
For more examples of `.fga.yaml` files, check the [sample-stores repository](https://github.com/openfga/sample-stores/)/
641+
For more examples of `.fga.yaml` files, check our [Store File Format documentation](docs/STORE_FILE.md) and the [sample-stores repository](https://github.com/openfga/sample-stores/)/
642642

643643
###### Response
644644

0 commit comments

Comments
 (0)