OpenApi 2.0 How to define return type byte[] (it will be zip data) using typescriprt

Discussão em 'Angular' iniciado por Damien Cooke, Janeiro 14, 2025.

  1. Damien Cooke

    Damien Cooke Guest

    I have the following YAML:

    /document/zip:
    get:
    produces:
    - application/zip
    tags:
    - zipFileFolder
    operationId: getRawDocumentFileZipData
    parameters:
    - in: body
    name: args
    required: true
    schema:
    type: array
    items:
    $ref: './definitions/model/document-metadata.yaml#/DocumentMetadata'
    responses:
    200:
    description: The document file data as a zip file
    schema:
    type: string
    format: binary
    400:
    description: bad input parameter


    In case you may want to know the input type

    DocumentMetadata:
    type: object
    required:
    - id
    - name
    properties:
    id:
    type: number
    fileName:
    type: string


    This generates the following API

    public getRawDocumentFileZipData(args: Array<DocumentMetadata>, observe?: 'body', reportProgress?: boolean): Observable<string>;


    As you can see it returns an Observable<string> What I need/want is it to return an Observable<Uint8Array> or Observable<ArrayBuffer>. Can someone please point me in the correct direction?

    Continue reading...

Compartilhe esta Página