-
Notifications
You must be signed in to change notification settings - Fork 46
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
Derived QueryFragment can't handle unspecified enum argument types. #36
Labels
🐞 bug
Something isn't working
Comments
obmarg
added a commit
that referenced
this issue
Jun 13, 2020
The previous implementation of arugment structs in the query DSL had some issues: 1. Supplying arguments was pretty verbose, particularly where you wanted to supply required _and_ optional arguments or where you didn't want to supply args at all, but the field had some. 2. You also needed to import structs from their nested modules, which was also probably not great. 3. The optional argument structs tried to derive Default, but due to issues with the default derive this forced all argument types to also implement default (See #40) 4. Finally, there were some serious problems around enum arguments where we needed to proivde a generic parameter but were completely unable to as the argument wasn't being provided. (See #36) This updates the query DSL so that each field selector function takes required arguments, and then returns a FieldSelectionBuilder. This FieldSelectionBuilder will expose a function for each optional argument, and a select function that will output the corresponding SelectionSet for use in the query heirarchy.
obmarg
added a commit
that referenced
this issue
Jun 13, 2020
The previous implementation of arugment structs in the query DSL had some issues: 1. Supplying arguments was pretty verbose, particularly where you wanted to supply required _and_ optional arguments or where you didn't want to supply args at all, but the field had some. 2. You also needed to import structs from their nested modules, which was also probably not great. 3. The optional argument structs tried to derive Default, but due to issues with the default derive this forced all argument types to also implement default (See #40) 4. Finally, there were some serious problems around enum arguments where we needed to proivde a generic parameter but were completely unable to as the argument wasn't being provided. (See #36) This updates the query DSL so that each field selector function takes required arguments, and then returns a FieldSelectionBuilder. This FieldSelectionBuilder will expose a function for each optional argument, and a select function that will output the corresponding SelectionSet for use in the query heirarchy. Fixes #40, Fixes #36
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Selection functions for fields with enum arguments have a generic parameter for the enum argument type. However, when you're not providing the enum argument, there's no way for Rust to infer the type of that generic parameter and you get errors. Since this is happening inside a query fragment derive there's not even a way to provide it.
I did experiment with adding an
UnknownEnumType
type and putting a default generic parameter on the argument struct, but it wasn't enough.Think we might need to switch to a builder pattern for arguments (either on the argument structs themselves, or potentially for the fields themselves.
The text was updated successfully, but these errors were encountered: