Open svobom57 opened 1 year ago
@svobom57 Unfortunately, I'm not working with Rails at my current job and have no bandwidth to help here. It looks like that may be true for the other contributors to this project as well. If you (or anyone else) have interest in picking up ownership, please let me know. Sorry!
@wagenet Opened up a PR here: https://github.com/graphiti-api/graphiti-rails/pull/109 Let me know what else to do. š
We are facing a peculiar issue where we override the
jsonapi
parser in order to make the incoming payloadsnake_case
instead ofcamelCase
.We use a solution similar to the one proposed here: https://github.com/graphiti-api/graphiti/issues/286
where at some point we call:
ActionDispatch::Request.parameter_parsers[:jsonapi] = transformer
Now the problem is that
graphiti-rails
does the same thing here in the Railtie: https://github.com/graphiti-api/graphiti-rails/blob/759db8d25f14ae4b171e9b961e51ab50027a0d67/lib/graphiti/rails/railtie.rb#L75 which then overrides our custom implementation if called after our custom initialisation.We have this set up in quite a few repos but for one of our repos the initialisation process (for some reason I'm not sure of) is reversed and the order of the calls are as follows:
graphiti-rails
Railtie is called overriding our custom parserI'm not quite sure what determines the order of the Railtie call and our initialisation but I'm thinking that perhaps the gem should be resilient to this and only assign the transformer if one does not already exist, i.e. instead of the current code:
run: