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 schema types to be pluggable #228

Merged
merged 1 commit into from
Jan 18, 2017

Conversation

Fivell
Copy link
Contributor

@Fivell Fivell commented Jan 17, 2017

this refactoring allows developers to add support of new schema types

Copy link
Collaborator

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

Thanks for this. It makes a lot of sense to do it this way. The only change is to improve maintainability in the future and simplicity for the end-user.

end
end

JsonApiClient::Schema::TypeFactory.register money: MyMoneyCaster
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small change: having the users register on the TypeFactory class locks to this implementation. It'll most likely remain this way, but it might make more sense for the developer to call .register on the Schema class/module instead. If for whatever reason, we want to rename the TypeFactory class or refactor it, we need to keep that constant around. Internally, JsonApiClient::Schema.register could just delegate to JsonApiclient::Schema::TypeFactory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chingor13 , repushed.

this refactoring allows developers to add support of new schema types
@Fivell
Copy link
Contributor Author

Fivell commented Jan 18, 2017

@chingor13 , done!

@chingor13 chingor13 merged commit d301e30 into JsonApiClient:master Jan 18, 2017
@Fivell Fivell deleted the type_casting_refactoring branch January 18, 2017 07:30
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