feat(import): allow to use tuples and tuple_file together
Description
The current implementation on fga store import supports a configuration file with tuples and tuple_file fields.
When tuple_file field is defined, all the tuples defined are ignored.
In this PR, I propose to join the tuples defined in the configuration file with the ones stored in the file set in tuple_file.
Allowing this, enables composition scenarios in which it is possible to share tuples between different store definitions.
Example
store_environment_a.yaml
name: Store Environment A
model_file: ./model.fga
tuple_file: ./shared.tuples.yaml
tuples:
- user: user:alice
relation: member
object: org:org_A
store_environment_b.yaml
name: Store Environment B
model_file: ./model.fga
tuple_file: ./shared.tuples.yaml
tuples:
- user: user:bob
relation: member
object: org:org_B
Review Checklist
- [x] I have clicked on "allow edits by maintainers".
- [ ] I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
- [x] The correct base branch is being used, if not
main - [ ] I have added tests to validate that the change in functionality is working as expected
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: DanielBertocci / name: Daniel Bertocci (1e6fda5d56f5d22d3548bf11fd59d7466a2495d0, f2774db5dc0c9cae2030308622fe66a4baea4b89)
- :white_check_mark: login: rhamzeh / name: Raghd Hamzeh (711621ad7007378df9e3ab8ca3a5b30e914a788a, 1b3aa294c027e0161b2df1e11e32367a5e908ae3, dafd5c4ece494dba3e01e57565d35b4af97cb5cf)
@DanielBertocci thanks for this and apologies it took us so long to get to this - we'll be taking a closer look at this and adding tests.
Thanks for your patience
Thanks @DanielBertocci - it does make sense to do this change, thank you for the suggestion and the PR. So as not to delay it, will merge it and we can update the docs after
We don't have great docs on the store file - we should create a docs/STORE_FILE.md that explains in details the components of the store file, how it can be used and with which commands and reflect the change in this PR.
The README should link to this file whenever it is discussing the format. Our VS Code and IntelliJ plugins should reference it in their own docs and our docs in openfga.dev should bundle it