ManualRead for wrapping an API using attribute constraints
I want to wrap an API with a resource. The response from the provider has a bunch of fields that can be
""
, which I'd prefer to be nil. Pretty sure this can be handled with constraints on attributes when the values are casted.
The example in the docs shows manually creating the resource's struct from the API response and using Ash.Query.apply_to/2-3
. Will this approach apply the constraints for the returned values doing this? Or is there a better way to make sure the constraints are applied?3 Replies
Solution
I don't think it will cast those inputs, no
You will probably need to handle that manually
Bummer. Recursive solution it is 🙂