-
Notifications
You must be signed in to change notification settings - Fork 219
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
Builder should support application-specific JSON MIME specifiers #1197
Comments
Hi @hermann-noll There are multiple aspects to this issue, here is the detailed explanation: While the generator aims to support multiple content types for the payload (request/response), it's currently hard-coded to only look for the
kiota/src/Kiota.Builder/KiotaBuilder.cs Line 550 in 6e6f379
This aspect dates from the POC era of Kiota and we have multiple issues logged to unlock additional content types/scenarios
Once the generation goes through, for the client to work properly, it needs registered ParseNode factories and SerializationWriter factories to handle the payloads correctly. They are also locked to a very specific content type
In theory, the reason why the API returns to your request a vendor specific mime type is because your application should be a different parser than "just JSON" to parse the response. It is not always the case in practice and parsing with the default implementations we provide might work just fine. Does all of that make sense? In which case here is what I suggest should be done:
|
@baywet We can safely assume that any media type that ends in +json can be parsed with our standard JSON parsing. https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.8 We should figure out what the model is for adding support for standard JSON based media types like application/problem+json and application/collection+json. |
thanks for jumping in @darrelmiller. So effectively parsing a |
Hi @hermann-noll , generation changeImagining we get the following content type in the description for the response content
runtime changesImagining we get the following content type (runtime
|
Hello @baywet , Great to hear, I am looking forward to using these changes 👍 |
It seems like currently only
application/json
is supported as MIME specifier. Instead the builder should also accept specifiers with the patternapplication/myapp+json
as is the case for e.g. GitHub (application/vnd.github.mercy-preview+json
)Additionally when using an OpenAPI document like below the kiota builder throws a
NullReferenceException
instead of a diagnostic error.The text was updated successfully, but these errors were encountered: