# How to link request examples with response examples in the OpenAPI specification

**URL:** <https://community.postman.com/t/how-to-link-request-examples-with-response-examples-in-the-openapi-specification/12495>\
**Category:** Help Hub\
**Tags:** openapi, tests, mocks, collections, mockservers\
**Created:** [May 8, 2020, 7:33pm UTC](https://community.postman.com/t/how-to-link-request-examples-with-response-examples-in-the-openapi-specification/12495 "2020-05-08T19:33:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![koble.postman3](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@koble.postman3](https://community.postman.com/u/koble.postman3)\
**Post date:** [May 8, 2020, 7:33pm UTC](https://community.postman.com/t/how-to-link-request-examples-with-response-examples-in-the-openapi-specification/12495/1 "2020-05-08T19:33:42Z")

</div>

I am using an API first approach to define my APIs with postman and OpenAPI 3.0. However I’ve encountered a problem with the examples when generating collections from the API specification.

When I am autogenerating a collection from the schema below, two examples are generated for post /products (one for the _201_ response status and another for the _400_). However both of them get assigned the same request example (_validRequest_).

Is there a way to assign the _validRequest_ example to the response _201_ and the _wrongRequest_ to the response _400_?

```
paths:
  /products:
    post:
      summary: Add Product
      description: Creates a new product.
      operationId: addProduct
      tags:
        - Products
      requestBody:
        description: A product schema.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Product'
            examples:
              wrongRequest:
                category: Jeans
                brand: Union
              invalidRequest:
                category: UknownCategory
                brand: Union
      responses:
        '201':
          description: Successful creation of product.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
              example:
                success: true
        '400':
          description: Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Product'
              example:
                success: false
```

---

<div class="post-metadata">

**Author:** ![cfrapper](https://avatars.discourse-cdn.com/v4/letter/c/e19adc/32.png) [@cfrapper](https://community.postman.com/u/cfrapper)\
**Post date:** [March 11, 2022, 3:41pm UTC](https://community.postman.com/t/how-to-link-request-examples-with-response-examples-in-the-openapi-specification/12495/2 "2022-03-11T15:41:38Z")

</div>

Hello, I’m facing the same issue, did you find a way to link response example to specific request example ?
