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

Allow key transforms #64

Merged
merged 2 commits into from
Sep 9, 2022
Merged

Allow key transforms #64

merged 2 commits into from
Sep 9, 2022

Conversation

tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Sep 8, 2022

If you ever want to change how Alchemy serializes attributes you can set

Alchemy::JsonApi.key_transform = :camel_lower

It defaults to :underscore.

@tvdeyen tvdeyen requested a review from mamhoff September 8, 2022 08:42
@tvdeyen tvdeyen marked this pull request as draft September 8, 2022 09:02
@tvdeyen tvdeyen removed the request for review from mamhoff September 8, 2022 09:02
@tvdeyen tvdeyen self-assigned this Sep 8, 2022
@tvdeyen tvdeyen changed the title Add a BaseSerializer Allow key transforms Sep 8, 2022
@tvdeyen tvdeyen marked this pull request as ready for review September 8, 2022 09:47
@tvdeyen tvdeyen removed their assignment Sep 8, 2022
If you ever want to change how Alchemy serializes attributes.
Ie. use camelCasing you can extend that class.
Supported transformations:

  :camel # "some_key" => "SomeKey"
  :camel_lower # "some_key" => "someKey"
  :dash # "some_key" => "some-key"
  :underscore # "some_key" => "some_key"

Defaults to :underscore.
Copy link
Contributor

@mamhoff mamhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

☺️☺️

@tvdeyen tvdeyen merged commit ff1639a into main Sep 9, 2022
@tvdeyen tvdeyen deleted the add-base-class branch September 9, 2022 06:32
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

Successfully merging this pull request may close these issues.

2 participants