-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
[Client] Allow query to specify every subtype of an interface #1103
[Client] Allow query to specify every subtype of an interface #1103
Conversation
0d4f08c
to
eedf601
Compare
So, I've recently implemented this PR for unions. Basically it generates 2 methods instead of 1, one with all union subtypes optional and the other where they are mandatory. How about doing the same for interfaces? It would be consistent and would prevent an additional configuration parameter. Also you would be free to use a mix of them in your code, which is more flexible than a single configuration. What do you think? |
I'll give it a shot :) EDIT: I see that before, on union subtypes, it was mandatory and you added a xxxOption method with default. For interfaces it will be the other way around. And as I guess we don't want to break compatibility how should I name this new method that will enforce all parameters to be set? |
Hmm I'd rather break and be consistent. We can mention it clearly in the release notes and it won't be hard to fix. It won't break code immediately for users unless they generate the code during compilation. Sounds reasonable? |
If we break it, I'll give #237 a thought and see if I find a good solution. It might also break so better to do all at once if possible. |
I'll have something by the end of the day 🤞 (in France) |
@AlixBa yeah, that's right. And it would be nice to add |
eedf601
to
ecc1185
Compare
I've updated with the first goal of this MR. |
ecc1185
to
0678ae1
Compare
899b9e7
to
450dfe3
Compare
The test error comes from this code generated in case (field @ FieldTypeInfo(_, _, _, interfaceTypes, _, _, Some(_)), fieldName) if interfaceTypes.nonEmpty =>
val tpe = genericSelectionFieldTypesMap(field)
interfaceTypes.map(intType => s"${fieldName}On$intType: Option[SelectionBuilder[$intType, $tpe]] = None") I guess it doesn't need to be an You can run |
450dfe3
to
09905c0
Compare
09905c0
to
e84dfac
Compare
Btw is this PR ready to review? I wasn't sure 😅 |
Ups, sorry @ghostdogpr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Rationale: We would like compilation to fail if there a new enum entry and we don't implement a selection builder