Skip to content

Access details of the SSE Response when in error #2908

@Pitouli

Description

@Pitouli

Description

In my OpenAPI, I have an API that returns a SSE stream when successful (code 200), but returns JSON for the other status (400, 500, etc.)

Currently, when the API fails with a 400 error, I find no way to get the details of the error: the error only sends up the status of the request, but not the content, so I cannot inform my user why is request failed (in my situation, the server sends a 400 error if the uploaded file has not the correct column names)

Reproducible example or configuration

No response

OpenAPI specification (optional)

  /api/v1/documents/{domain_id}/ingest_permanent_document_batch:
    post:
      tags:
        - documents
      summary: Ingest permanent documents and link them to assistants.
      description:
        Create links between assistants and documents from the given Excel
        file. Uses Server-Sent Events (SSE) to stream progress updates.
      operationId: ingestPermanentDocumentBatch
      parameters:
        - name: domain_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: Domain ID
            title: Domain Id
          description: Domain ID
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/Body_ingestPermanentDocumentBatch"
      responses:
        "200":
          description: SSE stream with progress updates
          content:
            text/event-stream:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/BatchIngestionSSEUpdate"
                  - $ref: "#/components/schemas/BatchIngestionSSEResult"
                  - $ref: "#/components/schemas/BatchIngestionSSEError"
        "400":
          description: Validation error.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ValidationErrorResponse"
        "422":
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HTTPValidationError"

System information (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🔥Something isn't workingclientClient package related

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions