Description
Currently, the WriteAuthorizationModelRequest object used for (write authorization model)[https://github.com/openfga/python-sdk/blob/main/README.md#write-authorization-model] is large and difficult to understand. Ideally, we want to break it apart into smaller pieces
For example,
body = WriteAuthorizationModelRequest(
schema_version = "1.1",
type_definitions=[
TypeDefinition(
type="user",
),
TypeDefinition(
type="document",
relations=dict(
writer=Userset(
this=dict(),
),
viewer=Userset(
union=Usersets(
child=[
Userset(this=dict()),
Userset(computed_userset=ObjectRelation(
object="",
relation="writer",
)),
],
),
),
)
),
],
)
can be broken up as
user_type = TypeDefinition(
type="user",
)
document_type = TypeDefinition(
type="document",
relations=dict(
writer=Userset(
this=dict(),
),
viewer=Userset(
union=Usersets(
child=[
Userset(this=dict()),
Userset(computed_userset=ObjectRelation(
object="",
relation="writer",
)),
],
)
),
),
)
body = WriteAuthorizationModelRequest(
schema_version = "1.1",
type_definitions=[
user_type,
document_type,
],
)
(and we break the document type relations into smaller pieces etc.)
The code in question is in
Line 299 in 1f4c734
Ideally, we will also fix the SDK generator so that newly generated python SDKs will have the corresponding changes. This is tracked as openfga/sdk-generator#126. However, if that is difficult to do, simply focusing on the Python SDK side https://github.com/openfga/python-sdk/blob/main/README.md will help us as well.
Metadata
Metadata
Assignees
Type
Projects
Status