Skip to content

Conversation

DanielBertocci
Copy link
Contributor

@DanielBertocci DanielBertocci commented Jul 29, 2024

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

  • 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]
  • 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

@DanielBertocci DanielBertocci requested a review from a team as a code owner July 29, 2024 08:58
Copy link

linux-foundation-easycla bot commented Jul 29, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@DanielBertocci DanielBertocci force-pushed the feat/store-import-combine-tuples branch 5 times, most recently from 32cdebc to 5110b2f Compare July 29, 2024 13:50
@DanielBertocci DanielBertocci force-pushed the feat/store-import-combine-tuples branch from 5110b2f to 1e6fda5 Compare July 29, 2024 13:52
@rhamzeh
Copy link
Member

rhamzeh commented Mar 19, 2025

@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

@rhamzeh rhamzeh enabled auto-merge April 21, 2025 12:37
@rhamzeh
Copy link
Member

rhamzeh commented Apr 21, 2025

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

@rhamzeh
Copy link
Member

rhamzeh commented Apr 21, 2025

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

@rhamzeh rhamzeh added this pull request to the merge queue Apr 21, 2025
Merged via the queue into openfga:main with commit c01c0e8 Apr 21, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants