cli icon indicating copy to clipboard operation
cli copied to clipboard

[Feature] Support wildcards in model paths for '.fga' files

Open dyeam0 opened this issue 5 months ago • 2 comments

Problem statement

Currently, when working with multiple authorization model files (.fga), each file path must be explicitly defined. For projects with a large number of .fga files, this becomes cumbersome and difficult to manage. It requires more maintenance and is error-prone. Users must manage a large quantity of .fga files and would benefit from a more streamlined way to include them.

Proposed solution

Add support for wildcards or regular expressions in the file paths for authorization models. This would allow users to include multiple .fga files using a single pattern.

For example, with an fga.mod manifest file:

schema: '1.2'
contents:
  - core.fga
  - parent_directory/subdirectory_1/foo.fga
  - parent_directory/subdirectory_1/bar.fga
  - parent_directory/subdirectory_1/baz.fga
  - parent_directory/subdirectory_2/foo.fga
  - parent_directory/subdirectory_2/bar.fga

For example, instead of listing each file individually, a user could specify a path like parent_directory/subdirectory_1/*.fga to include all .fga files within that directory.

Alternatives and current workarounds

The only alternative is the current method of manually listing each file, which is not ideal for larger projects.

Addional context

This feature should be implemented in the OpenFGA CLI. Additionally, this functionality should be considered for the VS Code and JetBrains extensions, as they also parse .fga files and would benefit from this enhancement for a consistent user experience across tools.

dyeam0 avatar Jul 10 '25 07:07 dyeam0

I have built this feature @dyeam0 Can you take a look, I have validated it using tests

https://github.com/openfga/cli/pull/543

SoulPancake avatar Jul 14 '25 06:07 SoulPancake

I can see the PR is currently under review with the Engineering team. Thanks @SoulPancake for your contribution!

dyeam0 avatar Jul 15 '25 14:07 dyeam0