-
Notifications
You must be signed in to change notification settings - Fork 304
Weakly typed path parameters and nullable response properties (C#) #2594
Description
I'm trying to use Kiota to generate a client for an internal API, but I'm running into a few issues that I can't seem to find documentation for - either in the actual documentation or previous issues, but I apologize if I'm just not looking hard enough :)
I'm using the following spec snippet for the issues below but it happens in samples as well:
"/foo/{fooId}": {
"get": {
"parameters": [
{
"name": "fooId",
"in": "path",
"required": true,
"schema": {
"type": "integer",
"format": "int32"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FooResponse"
}}}}}}}
"FooResponse": {
"required": [
"fooId"
],
"type": "object",
"properties": {
"fooId": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false
}
In the generated client I see the following issues:
-
In the request builder the indexer parameter is
string positionalthough the spec clearly states that it is an integer namedfooId. -
The generated
WithFooItemRequestBuilder.GetAsyncreturnsTask<FooResponse?>even though spec says it always returns a response. I could understand if this was to map 404 to null, but this does not appear to be the case. -
In the
FooResponsemodel the property forfooId, which in the spec is a required integer, is also nullable and this appears to be the case for all properties.
From what I've read Kiota is intended to generate easily usable clients from the consumer point of view so consistency is more important than tailoring the client to something the producer would like.
I'm fully on board with this perspective, but these issues, to me, does not align with that. So I'm curious as to why these choices were made.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status