# Generating Collection from OpenAPI returns \[object Object\]

**URL:** <https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081>\
**Category:** Help Hub\
**Tags:** collections, json\
**Created:** [August 10, 2022, 2:48pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081 "2022-08-10T14:48:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrabetr](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mrabetr/32/11062_2.png) [@mrabetr](https://community.postman.com/u/mrabetr)\
**Post date:** [August 10, 2022, 2:48pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/1 "2022-08-10T14:48:00Z")

</div>

I have an OpenAPI Schema and I used to generate collections for testing or documentation from it. However, i am now getting [object Object] in request bodies, when i used to get JSON request bodies following the schema definition.  
What might be causing this [object Object] instead of the correct JSON?

An example request body used to be auto-generated such as in this screenshot from the API Schema

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/b/b498fe52733cf690e70e8abfbaaed68279cfc89c.png)

However, I am now getting request body with [object Object] as follows

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/4/c4ec9e8803f608b94f257a2b154b50a598d04c05.png)

I haven’t used the generate collection action for some time so i am guessing some update to Postman may be resulting into the generation no longer working

I have tried generating a previous version of the schema where the generation worked fine to make sure this issue is not due to recent changes made to the OpenAPI schema

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 10:02am UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/2 "2022-08-11T10:02:08Z")

</div>

Hi @mrabetr

This might sound weird, but I think there is formatting that is being passed too.

Try stripping out these dots and replace with spaces or tabs:  
 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/6/6a890d8d49feffce064e950d98694d0ccfe9b077.png)

And see if it sends once they are removed…

---

<div class="post-metadata">

**Author:** ![mrabetr](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mrabetr/32/11062_2.png) [@mrabetr](https://community.postman.com/u/mrabetr)\
**Post date:** [August 11, 2022, 1:41pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/3 "2022-08-11T13:41:10Z")

</div>

hi @w4dd325, thanks for your response

However, my screenshots are showing body requests generated from the OpenAPI Schema, when generating a collection from it.  
The first screenshot is the correct JSON that was auto-generated from the API Schema and it works perfectly fine when sending a POST request with that body.

The second screenshot is basically Postman app failing to auto-generate the request body.

Therefore, what used to work during the collection generation from the API Schema is no longer working. I don’t usually maintain my collections manually. i have been updating my API Schema (definition in the Postman API tab) and from it i generate the collection for testing or documentation purposes.

The fact that the auto-generation of the request bodies is failing is now causing concerns because i can no longer create new collections on the fly and use them immediately. without the request bodies generated i will then have to copy past them manually

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [August 11, 2022, 2:20pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/4 "2022-08-11T14:20:13Z")

</div>

Ahh sorry my mistake, I understand now.

It’s not something I have a lot of knowledge on to be honest, I’ll have a poke around and see if i can recreate a similar scenario.

---

<div class="post-metadata">

**Author:** ![patrick-rsk](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@patrick-rsk](https://community.postman.com/u/patrick-rsk)\
**Post date:** [September 27, 2022, 12:46pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/5 "2022-09-27T12:46:01Z")

</div>

I have been experiencing this issue as well. I have a workaround and info to help track the bug down. @mrabetr @w4dd325

After testing a bunch of prior version of Postman, I can say it was introduced in either v9.26.x or v9.27.0. I was not able to download any v9.26, but 9.25.2 works as expected, and 9.27.0 displays `[object Object]` for imported request/response bodies.

I’ve been downloading these by fiddling with the direct download links, eg. [https://dl.pstmn.io/download/version/9.25.2/osx64](https://dl.pstmn.io/download/version/9.25.2/osx64) for the last version without the issue.

I’m on Mac but my colleague on windows has the same issues.

Here is some yaml that you can use as a bug repro:

```auto
openapi: 3.0.0
info:
  title: bug-repro
  version: '1.0'
  description: API specification.
servers:
  - url: 'http://localhost:5001'
paths:
  '/api/{tenancy}/name':
    parameters:
      - schema:
          type: string
        name: tenancy
        in: path
        required: true
        description: The tenancy id
    put:
      summary: Check name
      operationId: put-api-tenancy-name
      responses:
        '200':
          description: 'OK'
      requestBody:
        content:
          application/vnd.company.product.name-check-v1+json:
            schema:
              $ref: '#/components/schemas/Name-Check'
components:
  schemas:
    Name-Check:
      title: Name-Check
      description: |
        Model to check name uniqueness
      type: object
      properties:
        name:
          type: string
        type:
          type: integer
      required:
        - name
        - type

```

---

<div class="post-metadata">

**Author:** ![mrabetr](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mrabetr/32/11062_2.png) [@mrabetr](https://community.postman.com/u/mrabetr)\
**Post date:** [September 27, 2022, 4:53pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/6 "2022-09-27T16:53:27Z")

</div>

thanks @patrick-rsk for sharing your example.

After looking into your example i noticed that in the `requestBody` you’re using `application/vnd.company.product.name-check-v1+json` for the content type.

This has triggered me to try with `application/json` which doesn’t not result into `[object Object]`, but instead it correctly generates the JSON:

```auto
{
  "name": "amet in",
  "type": -3872749
}

```

The reason that caught my attention is because i use `application/vnd.api+json` in my API

@w4dd325 can you flag this bug please. basically, if the content type of the `requestBody` is application/json in the OpenAPI, the collection generated from it does produce a valid `JSON` object. However, if the content type is `application/vnd.api+json` then this results into the `[object Object]` bug

---

<div class="post-metadata">

**Author:** ![w4dd325](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/w4dd325/32/12436_2.png) [@w4dd325](https://community.postman.com/u/w4dd325)\
**Post date:** [September 27, 2022, 4:56pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/7 "2022-09-27T16:56:18Z")

</div>

I don’t work for Postman, but you can search for / open issues here:

> **[Issues · postmanlabs/postman-app-support](https://github.com/postmanlabs/postman-app-support/issues)**
>
> Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster. - Issues · postmanlabs/...

---

<div class="post-metadata">

**Author:** ![mrabetr](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mrabetr/32/11062_2.png) [@mrabetr](https://community.postman.com/u/mrabetr)\
**Post date:** [September 27, 2022, 7:54pm UTC](https://community.postman.com/t/generating-collection-from-openapi-returns-object-object/38081/8 "2022-09-27T19:54:04Z")

</div>

sorry about that @w4dd325  
thanks for sharing the link, i created a new issue:

> <https://github.com/postmanlabs/postman-app-support/issues/11300>
>
> \### Is there an existing issue for this?
> 
> \- \[X\] I have searched the tracker for …existing similar issues and I know that duplicates will be closed
> 
> \### Describe the Issue
> 
> When generating a collection from an OpenAPI definition, if the request body is of content type application/vnd.api+json then the generated request body fails and returns \[object Object\]
> However, if the content type application/json then the request body is created correctly
> 
> \### Steps To Reproduce
> 
> the bug is reproduced using the below definition. however the issue doesn't happen if the the content type of the post request's body is application/json instead of application/vnd.api+json
> 
> \`\`\`
> openapi: '3.0.0'
> info:
> version: '2022-07' 
> title: 'Shopify REST Admin'
> description: The Admin API lets you build apps and integrations that extend and enhance the Shopify admin.
> servers:
> - url: https://{mystore}.myshopify.com/admin/api/{version}
> description: Production server
> variables:
> mystore:
> description: My store's name
> default: '{{mystore}}'
> version:
> description: API version
> default: '{{version}}'
> paths:
> /products:
> post:
> summary: Create a new product
> description: Create a new product
> operationId: createProduct
> tags:
> - products
> requestBody:
> required: true
> content:
> application/vnd.api+json:
> schema:
> $ref: '#/components/schemas/productCreate'
> responses:
> '201':
> $ref: '#/components/responses/product'
> '422':
> $ref: '#/components/responses/unprocessableEntityError'
> '500':
> $ref: '#/components/responses/internalServerError'
> components:
> schemas:
> id:
> description: An unsigned 64-bit integer that's used as a unique identifier for the resource.
> type: integer
> example: 1071559583
> ids:
> description: A comma-separated list of product IDs.
> type: string
> example: 632910392,921728736
> date:
> description: Time at which the resource was created or updated.
> type: string
> format: date-time
> nullable: true
> example: 2022-07-31T19:20:04-04:00
> product:
> type: object
> properties:
> id:
> description: An unsigned 64-bit integer that's used as a unique identifier for the product. Each id is unique across the Shopify system. No two products will have the same id, even if they're from different shops.
> type: integer
> example: 1071559583
> title:
> description: The name of the product.
> type: string
> example: Burton Custom Freestyle 151
> body\_html:
> description: A description of the product. Supports HTML formatting.
> type: string
> nullable: true
> example: \<strong\>Good snowboard!\</strong\>
> vendor:
> description: The name of the product's vendor.
> type: string
> example: Burton
> product\_type:
> description: A categorization for the product used for filtering and searching products.
> type: string
> example: Snowboard
> created\_at:
> description: The date and time (ISO 8601 format) when the product was created.
> $ref: '#/components/schemas/date'
> handle:
> description: A unique human-friendly string for the product. Automatically generated from the product's title. Used by the Liquid templating language to refer to objects.
> type: string
> example: burton-custom-freestyle-151
> updated\_at:
> description: The date and time (ISO 8601 format) when the product was last modified. A product's updated\_at value can change for different reasons. For example, if an order is placed for a product that has inventory tracking set up, then the inventory adjustment is counted as an update.
> $ref: '#/components/schemas/date'
> published\_at:
> description: The date and time (ISO 8601 format) when the product was published. Can be set to null to unpublish the product from the Online Store channel.
> $ref: '#/components/schemas/date'
> template\_suffix:
> description: The suffix of the Liquid template used for the product page. If this property is specified, then the product page uses a template called "product.suffix.liquid", where "suffix" is the value of this property. If this property is "" or null, then the product page uses the default template "product.liquid".
> type: string
> nullable: true
> default: null
> status:
> description: The status of the product.
> type: string
> enum:
> - active
> - archived
> - draft
> default: active
> published\_scope:
> description: Whether the product is published to the Point of Sale channel.
> type: string
> enum:
> - web
> - global
> default: web
> tags:
> description: A string of comma-separated tags that are used for filtering and search. A product can have up to 250 tags. Each tag can have up to 255 characters.
> type: string
> example: Barnes & Noble, Big Air, John's Fav
> admin\_graphql\_api\_id:
> type: string
> example: gid://shopify/Product/1071559583
> productCreate:
> type: object
> required:
> - product
> properties:
> product:
> type: object
> required:
> - title
> properties:
> title:
> description: The name of the product.
> type: string
> example: Burton Custom Freestyle 151
> body\_html:
> description: A description of the product. Supports HTML formatting.
> type: string
> example: \<strong\>Good snowboard!\</strong\>
> vendor:
> description: The name of the product's vendor.
> type: string
> example: Burton
> product\_type:
> description: A categorization for the product used for filtering and searching products.
> type: string
> example: Snowboard
> published:
> type: boolean
> default: false
> published\_scope:
> description: Whether the product is published to the Point of Sale channel.
> type: string
> enum:
> - web
> - global
> default: web
> status:
> description: The status of the product.
> type: string
> enum:
> - active
> - archived
> - draft
> default: active
> tags:
> description: An array of string tags that are used for filtering and search. A product can have up to 250 tags. Each tag can have up to 255 characters.
> type: array
> items:
> type: string
> example: \["Barnes & Noble","Big Air","John's Fav"\]
> template\_suffix:
> description: The suffix of the Liquid template used for the product page. If this property is specified, then the product page uses a template called "product.suffix.liquid", where "suffix" is the value of this property. If this property is "" or null, then the product page uses the default template "product.liquid".
> type: string
> nullable: true
> default: null
> productResponse:
> type: object
> properties:
> product:
> $ref: '#/components/schemas/product'
> unprocessableEntityError:
> description: Unprocessable Entity (422) error object
> type: object
> properties:
> errors:
> type: object
> additionalProperties: true
> example:
> "title": \["can't be blank"\]
> notFoundError:
> description: Not Found (404) error object
> type: object
> properties:
> errors:
> type: string
> default: Not Found
> internalServerError:
> description: Internal Server (500) error object
> type: object
> properties:
> errors:
> type: string
> default: Internal Server Error
> responses:
> product:
> description: Successful response
> content:
> application/json:
> schema:
> $ref: '#/components/schemas/productResponse'
> products:
> description: Successful response
> content:
> application/json:
> schema:
> $ref: '#/components/schemas/productsResponse'
> unprocessableEntityError:
> description: Unprocessable Entity (422) error
> content:
> application/json:
> schema:
> $ref: '#/components/schemas/unprocessableEntityError'
> notFoundError:
> description: Not Found (404) error
> content:
> application/json:
> schema:
> $ref: '#/components/schemas/notFoundError'
> internalServerError:
> description: Internal Server (500) error
> content:
> application/json:
> schema:
> $ref: '#/components/schemas/internalServerError'
> securitySchemes:
> apiKey:
> type: apiKey
> in: header
> name: X-Shopify-Access-Token
> security:
> - apiKey: \[\]
> tags:
> - name: products
> description: Products are the individual items and services for sale in the store.
> \`\`\`
> 
> 
> \### Screenshots or Videos
> 
> \_No response\_
> 
> \### Operating System
> 
> macOS
> 
> \### Postman Version
> 
> 9.31
> 
> \### Postman Platform
> 
> Both
> 
> \### Additional Context?
> 
> \_No response\_
