-
Notifications
You must be signed in to change notification settings - Fork 30
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
Cannot write null to a nullable value #1188
Comments
Hi @mbursill |
Tested with both backing store and without. The generated model is:
The fields are all optional, meaning they're union with undefined, but assigning null is not possible. |
Thanks for the additional information. Is your goal of passing null to have null in the JSON payload to reset a field of an object for example? |
Yes, that's exactly what we're wanting it for. Undefined doesn't work for us in this case. Our API uses undefined to mean a change to the field was not made, and not to alter the value. To clear/reset the value we need null. |
Thanks for the additional context. |
any updates on this? |
Hey @baywet, I want to contribute. |
@rners01 you can run it straight in process if you want with a single command dotnet run --project ./src/kiota/kiota.csproj -- arguments you usually pass to kiota or you can tweak the .vscode/launch.json if you are using vs code. Make sure you have dotnet sdk 8 installed first Thanks for the time and help! |
@baywet but I don't see no |
sorry, I meant in the main repo |
but then I don't understand, I have changes in |
the kiota typescript repository only contains the typescript libraries (abstractions, serialization, http, authentication,...) the generation happens in the main kiota repository. |
do you have any high-level instruction what changes should I apply to process |
let's start with the TypeScript changes if you don't mind? Can you put a pull request together to make the following changes please? We'll then proceed to the generation changes as you won't be able to test them until the libraries here are updated. |
Hey @baywet, are there any changes needed for this to work? |
besides updating the dependencies and refreshing the client? or am I misunderstanding your question? |
yes |
turns out I found a missed update in my tests earlier. Once this is merged we should be good to go. |
Hey @baywet, after generating client from latest release build there are a lot of errors on new |
@Kindest13 you need to update the kiota packages (abstractions,...) |
@baywet Yes, you'r right.
|
@Kindest13 there's a long discussion around required/nullability here microsoft/kiota#3911 So for now the goal with TypeScript is to align it with the other languages, and eventually make it stable, before we look at changing those things across languages. |
Our API depends on null's being allowed as part of the request:
This is different than sending undefined for inspectionDetails. Our API treats undefined on patch as no change, but null as a means to clear the value.
While the swagger file defines the type as nullable, the generated code only allows
InspectionDetails | undefined
We've tried to hack a value by doing:
inspectionDetails: <InspectionDetails>(<unknown>null)
This is awful and still doesn't work. This call to writeObjectValue strips it.
The text was updated successfully, but these errors were encountered: