Issue generating an Angular endpoint / Model with multipart/form-data

Discussão em 'Angular' iniciado por PaulD, Fevereiro 18, 2025.

  1. PaulD

    PaulD Guest

    The following is an excerpt from my OpenAPI specification that I use to generate my angular services with openapi-generator-cli:

    requestBody:
    content:
    multipart/form-data:
    schema:
    type: object
    properties:
    test:
    type: array
    items:
    type: string
    format: byte


    This request body fails to generate with the following warning output in the generation process:

    [main] WARN o.o.codegen.DefaultCodegen - Could not compute datatypeWithEnum from string, null


    I originally had a more complex structure of schemas, but I narrowed it down to this part:

    an object with a property that is an array containing a byte array (putting the items of the array in an object has no impact). If I were to move the byte array property into the test object, it generates, but as soon as I have one or multiple arrays containing the byte array it does not work anymore.

    I run the generator command through npm as a script:

    "openapi-generator-cli generate -i ../../../../openapi/openapi.yaml -g typescript-angular -o src/generated-sources/openapi --additional-properties=supportsES6=true,npmVersion=6.9.0,ngVersion=14",


    Previously I had the content type set to application/json and it worked fine, simply changing the content type to multipart/form-data made it not work anymore and I sadly am required to use multipart/form-data in the future.

    Help or suggestions are highly appreciated

    What I have tried:


    Continue reading...

Compartilhe esta Página