Skip to content

Problem with multipart-multifile post-body #43

@tuxedo0801

Description

@tuxedo0801

After creating the code for nodejs I tried to start the project by npm start in the out-folder.

But I get an error message:

API Errors:

  #/paths/~1task~1/post/parameters/0: Not a valid parameter definition
    #/paths/~1task~1/post/parameters/0: Not a valid parameter definition
      #: Missing required property: schema
      #: Not a valid undefined definition
        #/type: No enum match for: object
        #/type: No enum match for: object
        #/type: No enum match for: object
        #/type: No enum match for: object
    #/paths/~1task~1/post/parameters/0: Missing required property: $ref

1 error and 0 warnings

The corresponding yaml-part:

  /task:
    post:
      tags:
        - app
      summary: create task
      operationId: createTask
      description: |
        todo
      responses:
        '200':
          description: OK
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                offerNumber: # metadata part
                  description: 'todo'
                  type: string
                trayImages: # image part
                  type: array
                  items:
                    type: string
                    format: base64
              required:
                - offerNumber
                - trayImages
            encoding:
              trayImages: 
                contentType: image/png, image/jpeg
        required: true

The idea behind this: The POST request must contain a kind of meta-data (the "offernumber"), and at least one image file. The number of images is not specified. It depends on how much the client wants to pass to the server.

See also: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#special-considerations-for-multipart-content

The API was designed with help of swaggerhub. And swagger-hub does not show me any error.

Can someone tell me what's wrong with my API?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions