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

Fix typelizer options merging in inherited serializers #27

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

Envek
Copy link
Contributor

@Envek Envek commented Nov 26, 2024

It should be possible to override individual typelizer options in inherited sertializers:

class BaseSerializer < ActiveModel::Serializer
  include Typelizer::DSL

  typelize plan_id: [:string, comment: "The ID of the plan, which will look like plan_*************"]
end

class ReceiptSerializer < BaseSerializer
  typelize plan_id: [:string, nullable: true]
end

Behavior before this pull request: child serializer definition is ignored altogether

Behavior implemented: options from the whole inheritance chain are used, child options takes precedence (overwriting options from parent serializers)

{ plan_id: [:string, nullable: true, comment: "The ID of the plan, which will look like plan_*************"]

@skryukov skryukov merged commit c228024 into skryukov:main Nov 26, 2024
5 checks passed
@Envek Envek deleted the fix/inheritance branch November 26, 2024 12:00
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