Solved
Forum Discussion
HKosova
Alumni
5 years agoOpenAPI doesn't have a way to vary request payload based on parameter values. What you can can do is provide multiple examples for the request body - assuming you use OpenAPI 3.0.
openapi: 3.0.0
paths:
/something/{index}:
post:
parameters:
- in: path
name: index
required: true
schema:
type: string
enum:
- foo
- bar
requestBody:
required: true
content:
application/json:
schema:
...
examples: # <--------------
foo:
summary: Request body for index=foo
value:
prop1: value1
prop2: value2
bar:
summary: Request body for index=bar
value:
something: else