Contributions
Multiple Request Body Examples for Multipart/Form-Data
Is it possible for the request body of an endpoint to have multiple examples if the content-type for both examples is multipart/form-data? This functionality is supported for content-type application/json. If so, how can multiple examples be added for multipart/form-data? Here is what I have thus far in Swagger Editor. The examples "Test One" and "Test Two" are rendering for the application/json content-type: /test: post: tags: - Test summary: This resource is used for testing purposes description: >- This is to test multipart/form-data examples. operationId: test requestBody: $ref: '#/components/requestBodies/DummyTest' responses: '201': $ref: '#/components/responses/TestStatus' schemas: DummyTest: type: object properties: dayOfTheWeek: type: string description: Day of the week example: 'Monday' month: type: string description: Month example: 'August' year: type: string description: Year example: '2010' timeOfDay: type: string description: Time of Day example: 'AM' requestBodies: DummyTest: content: application/json: schema: $ref: '#/components/schemas/DummyTest' examples: DummyOne: $ref: '#/components/examples/DummyOne' DummyTwo: $ref: '#/components/examples/DummyTwo' multipart/form-data: schema: $ref: '#/components/schemas/DummyTest' examples: DummyOne: $ref: '#/components/examples/DummyOne' DummyTwo: $ref: '#/components/examples/DummyTwo' examples: DummyOne: summary: Test One value: dayOfTheWeek: 'Monday' month: 'August' year: '2010' timeOfDay: 'AM' DummyTwo: summary: Test Two value: dayOfTheWeek: 'Tuesday' month: 'October' year: '1910' timeOfDay: 'PM' Any insight is greatly appreciated. Thank you!590Views0likes0Comments