What is the valid regex or the valid characters for the name of a type in a model? #302
-
In a model in DSL format or Json format, it looks like defining types with names that contain I find pretty intuitive to have characters like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The correct regex is the one used by the API:
There's additionally these set of regexes defined in the API:
Validation has to pass both sets of regexes in order to be valid according to the API. On the VS Code/Playground side we use a different set of less permissive regexes: We have yet more regexes in language: We do plan on standardizing these, this will probably happen sometime within the next couple of months as part of a larger work to move validation ownership to the language repo. Relevant issue: openfga/language#226 |
Beta Was this translation helpful? Give feedback.
The correct regex is the one used by the API:
"^[^:#@\\s]{1,254}$"
"^[^:#@\\s]{1,50}$"
"^[^\\s]{2,256}$"
"^[^\\s]{2,256}$"
There's additionally these set of regexes defined in the API:
https://github.com/openfga/openfga/blob/main/pkg/tuple/tuple.go#L35-L38