Skip to content

Convertion creates an empty body field not accepted by the Postman API #829

@andrefpoliveira

Description

@andrefpoliveira

Hey,

While trying to convert my documentation in OpenAPI with the following endpoint:

...
"/users": {
  "get": {
    "summary": "List all the users",
    "description": "...",
    "operationId": "listAllClients",
    "parameters": [
      {
        "name": "organizationId",
        "in": "query",
        "schema": {
          "type": "string",
          "example": "org_1234"
        },
        "required": true,
        "description": "The prefixed (org_) organization id of the querying organization."
      }
    ],
    "responses": {}
  }
}
...

This is the final result (removed some fields that don't matter):

{
    "id": "...",
    "name": "List all clients",
    "request": {
        "name": "List all clients",
        "description": {
            "content": "...",
            "type": "text/plain"
        },
        "url": {...}
        "method": "GET",
        "body": {},
        "auth": null
    },
    "response": [],
    "event": []
}

It was generated the field body: {} that is not compatible with the API endpoint POST https://api.getpostman.com/collections (Create a Collection).

Once I remove all the empty body fields it becames a valid JSON file.

If it helps, here is part of the error message:

{"error":{"name":"malformedRequestError","message":"Found 646 errors with the supplied collection.","details":["item/0: must have required property 'request'","item/0/item/0/request/body: must be object","item/0/item/0/request/body: must be null","item/0/item/0/request/body: must match exactly one schema in oneOf","item/0/item/0/request: must be string","item/0/item/0/request: must match exactly one schema in oneOf","item/0/item/0: must have required property 'item'","item/0/item/0: must match a schema in anyOf", ...

Is there a way to disable this behaviour?
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions