The only reason(s) why the metadata field is needed today is because we did not want to break existing compatibility with the Userset definition in the map<string, Userset> and so we introduced an additional field. The Relation definition itself should encapsulate all of the information/metadata associated with the relation. Doing so will allow the OpenFGA core and other integrations to more seemlessly make use of a TypeDefinition and the relations contained therein without having to reconstruct a map[string]Relation all over the place in client code.
Today a
TypeDefinition
has the following protobuf definition:https://github.com/openfga/api/blob/main/openfga/v1/authzmodel.proto#L26
A more canonical and easier consume definition of a TypeDefinition would look like:
https://github.com/openfga/api/blob/main/openfga/v1/authzmodel.proto#L42
The only reason(s) why the
metadata
field is needed today is because we did not want to break existing compatibility with theUserset
definition in themap<string, Userset>
and so we introduced an additional field. TheRelation
definition itself should encapsulate all of the information/metadata associated with the relation. Doing so will allow the OpenFGA core and other integrations to more seemlessly make use of a TypeDefinition and the relations contained therein without having to reconstruct amap[string]Relation
all over the place in client code.References: https://github.com/openfga/openfga/pull/726/files#r1189164147