Nullable input type
See original GitHub issueFirst of all great work with this! Really like the developer experience using this generator. However, I encountered an issue (it might be me missing something rather than an issue 😄)
Have the following input type defined:
public record ModifyUnitAdministatorInput(
int Id,
Optional<string?> Cvr,
Optional<string?> CompanyName,
);
and mutation signature:
public async Task<ModifyUnitAdministratorPayload> ModifyUnitAdministator(
ModifyUnitAdministatorInput input, [Service] ApplicationDbContext dbContext) {...}
Generating the client:
var schema = await GraphQlGenerator.RetrieveSchema(url);
var csharpCode = new GraphQlGenerator().GenerateFullClientCSharpFile(schema, clientName);
Then I get some strange queries when building with nullable values:
string? value = null;
var unitAdminInput = new ModifyUnitAdministatorInput{ Cvr = value };
var mutationBuilder = new MutationQueryBuilder()
.WithModifyUnitAdministator(
new ModifyUnitAdministratorPayloadQueryBuilder()
.WithUnitAdministrator(
new UnitAdministratorQueryBuilder()
.WithCvr()
)
, unitAdminInput);
"mutation{
modifyUnitAdministator(input:{
cvr:\"GraphQLApiClient.QueryBuilderParameter`1[System.String]\"
})
{
unitAdministrator { cvr }
}
}"
Am I doing something wrong?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
input type="number" contains null rather than character
1 Answer 1 ... If you type something into a "number" input that's not a number, the value will be null . That's...
Read more >nullable inputs/args are not covered in the docs very well
for InputType and Args it is important to distinguish that null is a totally valid input when fields/args are marked nullable: true -...
Read more >Number Input, Allow null value, how do I set it to null?
I'm reading in some data into a Number Input. I have checked the "Allow null value" setting. I don't want it to default...
Read more >Using nullability in GraphQL
By default, every field in GraphQL is nullable, and you can opt in to mark it non-null. In this article, we'll go over...
Read more >No input field null validation on non nullable fields
2.9. 5 deals exclusively with inputs. Null values can either be specifically provided as null or understood as null if not given. GraphQL...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed, do you need a new nuget?
https://www.nuget.org/packages/GraphQlClientGenerator/0.9.4