Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deserialization changed uppercase to lowervase in nested hashes #2425

Open
artofhuman opened this issue Jul 28, 2021 · 1 comment
Open

deserialization changed uppercase to lowervase in nested hashes #2425

artofhuman opened this issue Jul 28, 2021 · 1 comment

Comments

@artofhuman
Copy link

Expected behavior vs actual behavior

input = {"include"=>"",
 "data"=>
  {"attributes"=>
    {"field_type"=>"dropdown",
     "name"=>"new field name",
     "description"=>"new field description",
     "enabled"=>false,
     "mandatory"=>true,
     "data"=>{"default_value"=>"new default value", "options"=>[{"OPTION 1"=>"OPTION 3"}, "new option 1", "new option 2"]}}},
 "controller"=>"api/v1/companies/custom_cv_fields",
 "action"=>"update",
 "company_id"=>"498",
 "id"=>"174"}

attention on nested hash "options"=>[{"OPTION 1"=>"OPTION 3"}

ActiveModelSerializers::Deserialization.jsonapi_parse(input)

=> {:field_type=>"dropdown",
 :name=>"new field name",
 :description=>"new field description",
 :enabled=>false,
 :mandatory=>true,
 :data=>{"default_value"=>"new default value", "options"=>[{"option 1"=>"OPTION 3"}, "new option 1", "new option 2"]}}

deserialization changes nested hashes. "options"=>[{"option 1"=>"OPTION 3"}

Expected behavior: deserialization should not change nested hashes

Environment

ActiveModelSerializers Version (commit ref if not on tag):
gem 'active_model_serializers', '~> 0.10.8'

Output of ruby -e "puts RUBY_DESCRIPTION":
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]

OS Type & Version:
Linux

Integrated application and version (e.g., Rails, Grape, etc):
Rails

@artofhuman artofhuman changed the title Deserializtion changed uppercase to lowervase in nested hashes deserialization changed uppercase to lowervase in nested hashes Jul 28, 2021
@bf4
Copy link
Member

bf4 commented Jul 28, 2021

This something you think you might be able to investigate and propose a PR for? AMS is in maintenance now and I personally haven't used it in a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants