Closed protestContest closed 7 months ago
I'm not opposed to the current naming, but since you are interested in alternative ideas: "shallow" is an alright word for what you're doing here.
This seems like a good direction to go in. I'll do a more in-depth look at your implementation of expand_fields_once
after you've wrapped up your first draft.
Ok, I've updated the config values to :camelize_shallow
and :dasherize_shallow
and updated the docs around this config option. I also included a couple minor unrelated fixes to appease the linter.
Totally. What do you think of expand_keys
? That sounds more descriptive to me.
expand_root_keys
? I'm good with expand_keys
too since it no longer sounds like it is as closely related to expand_fields
, but expand_keys
would need some code-documentation explaining that it only looks at keys in the root of the map (perhaps that documentation is useful regardless of the name).
expand_root_keys
sounds good to me, I'll update that and add some docs.
I'll cut a new release shortly. https://github.com/beam-community/jsonapi/pull/311
Following up on this discussion.
This adds two new values for the config option
transform_fields
:camelize_shallow
: Likecamelize
, but only affects the relationship and attribute keys, not their values.dasherize_shallow
: Likedasherize
, but only affects the relationship and attribute keys, not their values.Some users may have views with fields that are maps, and don't want the map's keys dasherized or camelized. The new config values allow these users to use the
transform_fields
option to transform only the field names, but not the values.Feedback is requested. I don't really like the config value names—preferably we can think of something better. If this seems like the right direction, I'll continue to update the documentation.