Skip to content

OpenAPI Examples are not respected in generated documentation #9168

@mahirk

Description

@mahirk

Describe the bug
Postman API to Collection generation does not support examples in the objects. The strategies are described here: https://swagger.io/docs/specification/adding-examples/

To Reproduce
Steps to reproduce the behavior:

  1. Go to "Browse"
  2. Click on "Create new API" with "Open API 3.0"
  3. Enter test names and open "Define"
  4. A sample schema should be present. Replace the schema with
openapi: 3.0.2
info:
  title: My API
  version: 0.0.0
paths:
  '/users/{someOtherString}':
    post:
      operationId: CreateUser
      parameters:
        - name: someOtherString
          in: path
          description: property-two-examples description
          required: true
          schema:
            type: string
          examples:
            property-example-one:
              value: stringOne
            property-example-two:
              value: stringTwo
        - name: someString
          in: header
          description: Header for XYZ ABC Purposes
          required: true
          schema:
            type: string
          examples:
            property-example-one:
              value: VALUE X
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
        required: true
      responses:
        '201':
          description: 201 response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserResponse'
components:
  schemas:
    CreateUserRequest:
      type: object
      properties:
        firstName:
          type: string
        lastName:
          type: string
      required:
        - firstName
        - lastName
    CreateUserResponse:
      type: object
      properties:
        firstName:
          type: string
        lastName:
          type: string
        role:
          type: string
      required:
        - firstName
        - lastName
        - role
  1. Save
  2. Click on "Develop"
  3. Create Documentation
  4. Open documentation

Expected behavior
The examples request and response should use the example values provided in the specification.

Screenshots
Screen Shot 2020-10-14 at 11 53 54 PM

App information (please complete the following information):
App Type: Chrome App
Postman Version: Latest on browser
OS: [e.g. macOS Mojave 10.14.6]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions