-
Notifications
You must be signed in to change notification settings - Fork 42
Description
When attempting to send a request that has an enum as body through a generated client, an exception is thrown from SetContentFromScalar
in RequestInfo
(Microsoft.Kiota.Abstractions
- 1.17.2).
The function contains a big switch function that is missing an option that allows an enum through.
Important to note that the enum was also generated by Kiota.
Function used to generate:
kiota generate --exclude-backward-compatible --class-name KiotaClient --output "./KiotaClient" --language CSharp --openapi "./KiotaClient.OpenAPI.yaml" --namespace-name "KiotaClient" --disable-ssl-validation --clean-output --clear-cache
OpenAPI schema example:
openapi: 3.0.3
info:
version: v1.0
title: KiotaClient Bug Example
description:
Example
servers:
- url: https://localhost:5000/
paths:
"/api/":
put:
requestBody:
required: true
content:
application/json; charset=utf-8:
schema:
$ref: "#/components/schemas/state"
examples:
started:
summary: OptionA
value: "OptionA"
stopped:
summary: OptionB
value: "OptionB"
responses:
"204":
description: State was changed
components:
schemas:
state:
description: Device state
type: string
enum:
- OptionA
- OptionB
Edit:
Upon further investigation, this problem may be linked to the client generation and not Microsoft.Kiota.Abstractions
, as a similar problem presents when the body of the request is of an UntypedNode type instead of an Enum.
There seems to be a problem with fitting the client request function body with the function body's type - no matter what type is sent, they're all sent to the SetContentAsScalar
function, which lacks support for those types (Enum and UntypedNode are the ones I came across).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status