Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
andrefpoliveira opened this issue Sep 23, 2024 · 0 comments

Comments

@andrefpoliveira
Copy link

andrefpoliveira commented Sep 23, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant