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

Prevent casting when chaining from deserialize #89

Open
maxveldink opened this issue May 29, 2024 · 0 comments
Open

Prevent casting when chaining from deserialize #89

maxveldink opened this issue May 29, 2024 · 0 comments

Comments

@maxveldink
Copy link
Owner

Currently, when you deserialize into a struct, we need to do casting if we use the result in a chain:

CreateEntityRequest
  .deserialize_from(:hash, entity_params.to_h)
  .and_then { |create_entity_request| CreateEntity.call(T.cast(create_entity_request, CreateEntityRequest)) }

This is because the deserialize result payload is a T::Struct but we can't guarantee the type. We should be able to fix this with a Tapioca compiler that adds more specific RBIs for each T::Struct present in your application.

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

No branches or pull requests

1 participant