Transform model to extended format #417
Replies: 2 comments 1 reply
-
After a lot of research, I've realized that this is probably caused by the As it turns out, the default marshaller has the This causes the marshaller to set default values for certain data types as explained in the docs. Notably, it sets This behaviour can be changed by providing custom marshaller to the framework using the To me, this behaviour increasingly looks like a bug. I'd be keen to get your perspective on this @aaguiarz. |
Beta Was this translation helpful? Give feedback.
-
If the input contains some unpopulated fields, what is the expected output? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It occurs to me that the OpenFGA API is returning a "richer" authorization model JSON response than the one provided in the "write" call.
In particular, say you store this authorization model:
Once I read it back from the API, it looks like this:
I.e. it has some additional (optional) fields now like
"relations": {}
or"generic_types": []
or"module": ""
.Background
I'm trying to write a terraform provider and I want to store the model in JSON representation in the state. However, the fact that I receive a different response compared to what I've sent makes this difficult. Terraform will continuously identify a changed state. Hence, I want to be able to convert the user's input into the "rich" format first before storing it in the state.
Is there a library out there (perhaps in
openfga/language
) that can convert the first JSON (without the optional fields) into the second representation (with default values for the optional fields)?Beta Was this translation helpful? Give feedback.
All reactions