refactor: change TypeDefinition signature to be more canonical
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 27
- Forks
- 24
- Avg merge
- 12d 6h
- Merged PRs (30d)
- 1
Description
Today a TypeDefinition has the following protobuf definition:
message TypeDefinition {
string type = 1;
map<string, Userset> relations = 2;
Metadata metadata = 3;
}
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:
message TypeDefinition {
string type = 1;
map<string, Relation> relations = 2;
}
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 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.
References:
https://github.com/openfga/openfga/pull/726/files#r1189164147
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with openfga/v1/authzmodel.proto at the TypeDefinition and Relation definitions, then review the compatibility rationale and the referenced openfga PR discussion. Trace how TypeDefinition relations and metadata are consumed; done means the canonical map<string, Relation> shape is defined without the redundant metadata field and compatibility impacts are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100