Skip to content

text/event-stream response not generated #7215

@verdie-g

Description

@verdie-g

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

Csharp

Describe the bug

When an OpenAPI spec defines multiple response content types for the same status code (e.g., application/json AND text/event-stream), Kiota only generates code for application/json and ignores text/event-stream.

Expected behavior

Both schemas for application/json and text/event-stream should be generated.

How to reproduce

kiota generate -l CSharp -d openapi.yaml -c ChatClient -n ChatApi -o ./generated

Open API description file

openapi: 3.0.3
info:
  title: Chat API
  version: 1.0.0
paths:
  /v1/chat/completions:
    post:
      summary: Chat Completion
      operationId: chat_completion_v1_chat_completions_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/CompletionEvent'
components:
  schemas:
    ChatCompletionRequest:
      type: object
      properties:
        prompt:
          type: string
        stream:
          type: boolean
      required:
        - prompt
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
        content:
          type: string
    CompletionEvent:
      type: object
      properties:
        event:
          type: string
        data:
          type: string

Kiota Version

1.29.0+c21ebceb977bc33def3d8a9e5237b798a7b962b6

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

No response

Debug output

Click to expand log ``` dbug: Kiota.Builder.KiotaBuilder[0] kiota version 1.29.0 info: Kiota.Builder.KiotaBuilder[0] loaded description from local source dbug: Kiota.Builder.KiotaBuilder[0] step 1 - reading the stream - took 00:00:00.0033269 warn: Kiota.Builder.KiotaBuilder[0] OpenAPI warning: #/ - A servers entry (v3) or host + basePath + schemes properties (v2) was not present in the OpenAPI description. The root URL will need to be set manually with the request adapter. dbug: Kiota.Builder.KiotaBuilder[0] step 2 - parsing the document - took 00:00:00.0454893 dbug: Kiota.Builder.KiotaBuilder[0] step 3 - updating generation configuration from kiota extension - took 00:00:00.0000568 dbug: Kiota.Builder.KiotaBuilder[0] step 4 - filtering API paths with patterns - took 00:00:00.0023457 warn: Kiota.Builder.KiotaBuilder[0] No server url found in the OpenAPI document. The base url will need to be set when using the client. dbug: Kiota.Builder.KiotaBuilder[0] step 5 - checking whether the output should be updated - took 00:00:00.0097663 dbug: Kiota.Builder.KiotaBuilder[0] step 6 - create uri space - took 00:00:00.0014983 dbug: Kiota.Builder.KiotaBuilder[0] InitializeInheritanceIndex 00:00:00.0015606 dbug: Kiota.Builder.KiotaBuilder[0] CreateRequestBuilderClass 00:00:00 dbug: Kiota.Builder.KiotaBuilder[0] MapTypeDefinitions 00:00:00.0024026 dbug: Kiota.Builder.KiotaBuilder[0] TrimInheritedModels 00:00:00 dbug: Kiota.Builder.KiotaBuilder[0] CleanUpInternalState 00:00:00 dbug: Kiota.Builder.KiotaBuilder[0] step 7 - create source model - took 00:00:00.0290594 dbug: Kiota.Builder.KiotaBuilder[0] 12ms: Language refinement applied dbug: Kiota.Builder.KiotaBuilder[0] step 8 - refine by language - took 00:00:00.0123717 dbug: Kiota.Builder.KiotaBuilder[0] step 9 - writing files - took 00:00:00.0154130 info: Kiota.Builder.KiotaBuilder[0] loaded description from local source dbug: Kiota.Builder.KiotaBuilder[0] step 10 - writing lock file - took 00:00:00.0092459 Generation completed successfully ```

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    CsharpPull requests that update .net codestatus:waiting-for-triageAn issue that is yet to be reviewed or assignedtype:bugA broken experience

    Type

    No type

    Projects

    Status

    Needs Triage 🔍

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions