Skip to content

Example response body is incorrectly generated from schema #10172

@PrathibaJee

Description

@PrathibaJee

Is there an existing issue for this?

  • I have searched the existing issues

Describe the Issue

Postman mock server doesnt properly translate/generate response body when the specification(OAS) is having an example for an array of string/integer(schema) with more than 2 values. please find the complet details in the steps to reproduce.

Steps To Reproduce

  1. Open the API tab in postman
  2. Create a new API with schema type "OpenAPI 3.0" in Yaml format
  3. Define the specification with a schema that consists of a array of string/integer and also define an example for the same with more than two entries in the array as below, Also please find the attached yaml specification
    petStore_Yaml.TXT
    properties:
      petNames:
          type: array
          items:
             type: string
    example:
      petNames: ['one','two','three']
  1. Save the specification and goto 'generate collection' -> 'API Mocking'(Create mock server)
  2. Now goto collection tab -> to to the generated collection --> open the sample response body , it will be translated into an unexpected value as below ,
{
 "petNames": [
  "incididunt amet anim veniam",
  "proident consequat"
 ]
}
  1. But if you provide 2 entires for the array in the example as below,
    properties:
      petNames:
          type: array
          items:
             type: string
    example:
      petNames: ['one','two']
  1. Then if you generate a mock server , the reponse bodies are translating as expected ,
{
 "petNames": [
  "one",
  "two"
 ]
}

It seems to be a bug in the mock server generator in postman which is not converting the array of primitive datatypes with more than two values in the example. Kindly pleae let us know whether this is already a known issue (or) is there any workaround available for the same. Kindly let us know incase of additional details.

Screenshots or Videos

No response

Environment Information

- Operating System: Windows 10 64-bit
- Platform Type: Postman application installed in windows(Native App)
- Postman Version: V8.9.1

Additional Context?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions