Working with large integer values in AshJsonApi

Hi. I'm working with a database with tables that have integer columns being used as an alternative ID for legacy reasons, since the primary key is a UUID. Since the attributes corresponding to these fields are configured as an :integer in the Ash resource, AshJsonApi is returning them as a number type in the JSON responses that is getting truncated due to the length of the values. For example, a value like 953764064726843398 would get truncated to 953764064726843400 (notice how the 3 least significant digits changed). The way I've worked around this in other stacks is by treating them as a string value instead. I would like to do the same here, but I don't know if there's a straightforward way to achieve that using AshJsonApi . I basically want them to be parsed to and from a string while keeping the DB column as an integer, preferably without having to change the Ash resource attribute to a :string since that would affect more than just the exposed JSON:API.
2 Replies
barnabasj
barnabasj3w ago
I skimmed the code real quick and didn't see a way. but I think it's a reasonable request. If you create an issue I should be able to devote some time to this next week.
Noxis
NoxisOP3w ago
Will do, thank you!

Did you find this page helpful?