openfga / language

Grammar for the OpenFGA modeling language
https://openfga.dev
Apache License 2.0
15 stars 7 forks source link

Language is validating against valid cases where `this` is not in first place #166

Closed rhamzeh closed 4 months ago

rhamzeh commented 4 months ago

In the below case, Language should not treat it as unsupported by DSL, and should allow it

- name: relation def where this is not in first place
  json: >-2
    {
      "schema_version": "1.1",
      "type_definitions": [
        {
          "type": "user",
          "relations": {
            "rel1": {
              "this": {}
            },
            "rel2": {
              "union": {
                "child": [
                  {
                    "computedUserset": {
                      "relation": "rel1"
                    }
                  },
                  {
                    "this": {}
                  }
                ]
              }
            }
          },
          "metadata": {
            "relations": {
              "rel1": {
                "directly_related_user_types": [
                  {
                    "type": "user"
                  }
                ]
              },
              "rel2": {
                "directly_related_user_types": [
                  {
                    "type": "user"
                  }
                ]
              }
            }
          }
        }
      ]
    }
  valid: true