-
Notifications
You must be signed in to change notification settings - Fork 743
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
Why were GraphQLOperations changed from final to non-final? #3183
Comments
This was definitely just an oversight. I will add this to our backlog, but if you would like it completed sooner, we are always happy to accept a PR. Since I don't think we need to add it as a new codegen option, this is actually a pretty simple PR to make. The templates and the unit tests just need to be modified. |
Great to hear - I'll prep a PR tonight. I think I disagree on the need for making it an option, because people may have use cases where they might want to subclass the operations for whatever reason - but also chiefly because this would be a breaking change to introduce, as people's models will work differently than before with no way of going back to the old behavior. Perhaps in 2.x the option can be removed, but I think for a backwards-compatible release it would need to be configurable. |
We are actually taking advantage of it not being final. |
Thanks for letting us know that @jimisaacs! The PR #3189 that has been merged makes this a configuration option. It will be in the next release and won't change anything unless you opt in. |
Nice, sounds great. Thanks for the context, I just saw this go by on my feed so commented ;) |
@jimisaacs, could I dig deeper into what you're doing in the subclasses? If it's purely app-side logic then I guess not much for us to do but if there is something we could do in the generated models to better facilitate what you're doing let's explore it. |
@calvincestari sure, the use case is because we have query that is fetched in two contexts, in one of those contexts, it passes a particular parameter, while it is not in the other context. That parameter should not be used in the generation of a cache key, and we didn't have a better way to manipulate that process. So we ended up with a protocol that looks like this:
where This |
Question
During our migration from 0.36 to 1.3, we noticed that some of our code no longer compiles due to the
final
modifier being dropped from the generated GraphQL operation classes.Was this intentional, or a miss in parity during the re-write of the engine?
Would it be reasonable to at least offer this as a codegen option?
The text was updated successfully, but these errors were encountered: