postman-app-support icon indicating copy to clipboard operation
postman-app-support copied to clipboard

Support for multiple response examples when generating from API spec

Open tmdoit-zz opened this issue 6 years ago • 1 comments

Is your feature request related to a problem? Please describe. Collection generated via API spec adds only one example response per status code when used multiple possibilities via "oneOf" keyword.

Describe the solution you'd like Suppose we have defined responses in OAS3 spec:

            responses:
                '201':
                    description: OK
                    headers:
                        Location:
                            schema:
                                type: string
                '422':
                    description: Unprocessable Entity
                    content:
                      application/json:
                        schema:
                          oneOf:
                            - $ref: '#/components/schemas/resp1'
                            - $ref: '#/components/schemas/resp2'

Postman could generate two examples for 422 status code where one could be hit by header key set to ie. "x-mock-response-model-schema-name" with value "resp1".

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context One collection generated via API spec can be used by UI developers (all responses mocked).

tmdoit-zz avatar Jun 17 '19 10:06 tmdoit-zz

This is a blocker for my organization. We have some rather complex object schemas that utilize anyOf and oneOf extensively. I'm unable to preserve the API schemas when importing OAS files into Postman for the creation of collections.

stealthllama avatar Sep 12 '24 00:09 stealthllama