Open artofhuman opened 3 years ago
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
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]
ruby -e "puts RUBY_DESCRIPTION"
OS Type & Version: Linux
Integrated application and version (e.g., Rails, Grape, etc): Rails
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.
Expected behavior vs actual behavior
attention on nested hash "options"=>[{"OPTION 1"=>"OPTION 3"}
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