Closed Rodeoclash closed 1 year ago
🚀 Thank you for your contribution! 🚀
Ahh, this didn't fix it, I just added a test case which fails (and would be fixed calculations being run after a create action).
I wasn't sure how to fix, I just wanted to show the behaviour. Merging this will have broken main
Yep! I merged this and then fixed main.
This adds a test that now fails due to the lack of calculations being returned after a post/create request.
I've included
default_fields
in an attempt to get this to return the field, in my main branch this is returning#Ash.NotLoaded<:calculation>
which means that the field is being selected for serialisation, however, in this repo I can't seem to trigger the same behaviour. Instead, I'm getting no field back at all. I've tried upgrading the version of the underlying Ash framework to match my code but it doesn't seem to make a difference.Either way, I'd distil this down to the following: Calculated fields are not returned when post requests are completed
This calculation works fine for a read requests by using the
preparations
macro or by using aprepare
under the actions as expected.Ideally, I don't want the consumer of my API to have to make a
POST
to create the record then do a read to get the calculations on it but I can live with that if it's a won't/can't fix.The response coming back after trying to add the calculated field: