Hi there
I’ve to build a massive JSON file based on few different API calls. I want to use Dry::Struct To easily manipulate that data like:
obj = Test::DataStruct.new
obj.send_envelope_description = 1
but expected output should be camelcase:
#<Test::DataStruct SendEnvelopeDescription=1>
Additionally, passed data should into Test::DataStruct obj should accept camelcase keys like:
data = { SendEnvelopeDescription: 1 }
test = TestDataStruct.new(data)
=> #<Test::DataStruct SendEnvelopeDescription=1>
I tried to use transform_keys { |key| key.to_s.camelize }
but when I’m getting an error:
3.1.2 :045 > obj = Test::DataStruct.new(send_envelope_description: 1)
`block in resolve_missing_keys': [Test::DataStruct.new] :send_envelope_description is missing in Hash input (Dry::Struct::Error)
`block in resolve_missing_keys': :send_envelope_description is missing in Hash input (Dry::Types::MissingKeyError)
Is it possible to do so?