-
Notifications
You must be signed in to change notification settings - Fork 210
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
Kiota throws ApiException when server returns 304 #4190
Comments
Thanks for raising this @bkoelman I believe the other issue is the request adapter only considers codes in the 2XX range as success codes and therefore will throw an exception even if we add the value to the Would you be willing to submit a PR to update that as well as add the value to the collection? |
Hi @andrueastman, thanks for asking. I'm pretty overloaded with work right now, so I wouldn't mind if someone else fixes this. |
No worries. Will add this to pool to be worked on. For clarity, we need to
|
Was this closed unintentionally? From what I understand, the reported bug hasn't been fixed yet. |
It's been fixed on the generation side, now additional changes may be required in the http libraries. (see the linked issues above) |
So effectively, the reported bug isn't fixed yet. Can it be reopened? I reported a kiota feature not working, don't really care about internal components. Marking a bug as fixed means we can update and observe the reported problem doesn't happen anymore, which is not the case. Marking bugs as fixed when they really aren't kinda defeats the purpose of bug status tracking by anyone that depends on it. |
I understand the disagreement/confusion this can cause. |
I don't mind breaking it up and have multiple PRs contribute to solving a reported problem. In this case, the .NET part needs to be implemented to resolve the problem reported in this issue, so please reopen. This issue defines a bug from an outside user perspective. Our users see it in the list of limitations and understand how to work around it, based on the provided information here. Pointing them instead to a cryptic issue that only the kiota team understands is not community friendly. Our users will incorrectly infer the reported problem here does no longer occur, because it was closed as completed. Managing issues like that just doesn't make sense. |
Feedback noted around making it harder for the community to understand the state things are in. |
No. When I'm booking a vacation at a travel agency, which involves booking both a hotel and a flight, will they notify me of a succesful booking when in fact they only booked the flight? Of course not. If I open a support ticket for a Windows bug, and they fixed it in the kernel, but the Win32 API still doesn't call the fixed kernel, so my app still crashes, will they close the ticket as completed? Of course not. This issue reports a problem when using kiota, the product, not one of its internal components. The described issue isn't fixed, so it should remain open. I've never encountered a project, open or closed source, that uses such a non-intuitive workflow. A real paying customer would never accept such behavior. This again demonstrates the team cares about internals only, not its users. But as you seem unwilling to step out of that bubble, forget about it, I'm done with this silly discussion. |
- Generated project files target .NET 6 instead of 8 (going out of support end of this year). - Generated C# files don't have the "auto-generated" comment on the first line, causing code style warnings. - Running "liblab build" generates a separate project for the SDK and one for its usage; it should generate a single (combined) project by default for simplicity. - The inner loop experience is just as awful as kiota: no msbuild integration. What it should be: rebuild server project, which updates openapi.json, which regenerates the sdk (like NSwag does). - Would regenerate even work when I'm on a plane? Requiring an internet connection is a huge limitation. - Generated install.sh doesn't run on Windows, should use PowerShell instead. - Handling of required/nullable is handled better than kiota does, though not entirely correct (example: return type of PatchPersonAsync() should be nullable). - Inheritance using allOf with discriminator does not work, ie: TodoItemDataInResponse should inherit from DataInResponse (also oddly named "Type_" property generated). - Setting "responseHeaders": true in liblab.config.json does not work: generated code remains the same. - A new HttpClient instance is created each time during construction, which isn't scalable (and doesn't respond to DNS changes when long-lived). Should use HttpClientFactory instead. - There's no way to inject a DelegatingHandler, for example to log the HTTP requests and responses. - When sending a request, the user agent is set to "dotnet/7.0", looks like a bug. - Posting with a request body requires nasty code; should use "required init" properties instead of constructor parameters. Also the parameter order from openapi.json isn't respected. - There's no way to set the Content-Type when sending a request body. - Incorrect generated Type for "meta" (should be IDictionary<string, object?>? instead of object?) - There doesn't seem to be a way to intercept serialization to support partial patch (ie: sending "firstName: null" clears the value, whereas omitting the property doesn't change it). - NSwag allows to inject custom serializer options, where we add a custom JsonConverter. kiota handles it more elegantly by tracking property assignments. - Generated "response.EnsureSuccessStatusCode()" isn't correct: it fails when HTTP 304 is returned (similar to microsoft/kiota#4190). - Crash in response deserialization when HTTP 204 is returned with empty response body.
Our server returns HTTP 304 (Not Modified) without a response body when the incoming fingerprint in the
If-None-Match
header matches the stored version. This enables clients to poll for changes without receiving a response body, unless it has changed since it was last fetched.Status 304 is described in the OAS document, but Kiota throws an
ApiException
saying the error isn't mapped:OAS fragment:
Generated C# code:
To work around this, we need to catch an exception to detect HTTP 304 is being returned:
This looks like a bug to me. In
KiotaBuilder.cs
, I found the following line:Should that just be changed to include 304?
The text was updated successfully, but these errors were encountered: