We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When generating the SDL for an InputObject with defined defaults, the defaultable field should not be marked as required (no '!' type).
The following InputObject:
#[derive(InputObject)] struct SampleInput { required_input: i32, #[graphql(default = 1)] optional_input: i32 }
Should generate the following SDL input definition:
input SampleInput { optionalInput: Int = 1 requiredInput: Int! }
The following SDL is generated with the optionalInput field marked as required:
optionalInput
input SampleInput { optionalInput: Int! = 1 requiredInput: Int! }
Use the following code to reproduce:
use async_graphql::{Schema, EmptyMutation, EmptySubscription, SDLExportOptions}; use async_graphql_derive::{InputObject, Object}; struct Query; #[Object] impl Query { async fn sample(&self, _input: SampleInput) -> i32 { 1 } } #[derive(InputObject)] struct SampleInput { required_input: i32, #[graphql(default = 1)] optional_input: i32 } fn main() { let schema = Schema::build(Query, EmptyMutation, EmptySubscription).finish(); let sdl_opts = SDLExportOptions::new().sorted_arguments().sorted_fields(); println!("{}", schema.sdl_with_options(sdl_opts)); }
The text was updated successfully, but these errors were encountered:
Due to this issue the GraphiQL editor crashes because of invalid SDL (input both required and default value)
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Expected Behavior
When generating the SDL for an InputObject with defined defaults, the defaultable field should not be marked as required (no '!' type).
The following InputObject:
Should generate the following SDL input definition:
Actual Behavior
The following SDL is generated with the
optionalInput
field marked as required:Steps to Reproduce the Problem
Use the following code to reproduce:
Specifications
The text was updated successfully, but these errors were encountered: