Repository navigation
Closed
Labels
generatorIssues or improvements relater to generation capabilities.help wantedIssue caused by core project dependency modules or librarytype:bugA broken experience
Milestone
Description
When a HEAD endpoint contains only responses without a body (which should always be the case), Kiota generates Task<Stream?> as the response type. Is that intentional? I would have expected the return type to be Task.
Repro steps:
{
"openapi": "3.0.1",
"info": {
"title": "OpenApiTests",
"version": "1.0"
},
"paths": {
"/countries": {
"head": {
"tags": [
"countries"
],
"operationId": "headCountryCollection",
"responses": {
"200": {
"headers": {
"ETag": {
"required": true,
"schema": {
"type": "string"
}
},
"Content-Length": {
"required": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
}
},
"304": {
"headers": {
"ETag": {
"required": true,
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "The query string is invalid."
}
}
}
}
},
"components": {
"schemas": {
}
}
}Used command line:
dotnet kiota generate --language CSharp --class-name HeadersClient --namespace-name OpenApiKiotaEndToEndTests.Headers.GeneratedCode --output ./Headers/GeneratedCode --backing-store --exclude-backward-compatible --clean-output --clear-cache --log-level Error --openapi ../OpenApiTests/Headers/GeneratedSwagger/swagger.g.json
Metadata
Metadata
Assignees
Labels
generatorIssues or improvements relater to generation capabilities.help wantedIssue caused by core project dependency modules or librarytype:bugA broken experience
Type
Projects
- StatusShow more project fieldsDone ✔️

Activity
andrueastman commentedon Feb 27, 2024
Thanks for raising this Bart Koelman (@bkoelman)
Stream is used as a default if the response code is not in
noContentStatusCodes. What we would need to do is update the handling code here to have HEAD requests have a void return.kiota/src/Kiota.Builder/KiotaBuilder.cs
Line 1314 in 437045d
bkoelman commentedon May 18, 2024
I've just updated to v1.14, which changes the return type to
Task. Can you confirm this was fixed as intended?andrueastman commentedon May 20, 2024
Thanks for confirming. We'll close this one for now.
I believe this was resolved via #4367
bkoelman commentedon May 20, 2024
I was wrong about this, the bug is still there. But the situation got worse than before.
My OAS looks like this for the HEAD request:
Today kiota makes the return type
voidbecause one of the statuses is 304 (which is obviously wrong). If I change my OAS to:it generates
Streamas return type again. So please reopen.andrueastman commentedon May 20, 2024
Re-opening. The fix here would involve checking the request method(
HEAD) rather than the responses.Return void from HEAD executors instead of Stream (microsoft#8164)
deps: Bump the nuget group with 7 updates (#123)
chore(deps): Bump the minor-and-patch group with 22 updates (#301)