openapi-to-postman
openapi-to-postman copied to clipboard
Unable to PUT collection with API, Lost basic auth credentials when import with application
When I try to import with API:
curl --location --request PUT "https://api.getpostman.com/collections/${collectionId}" \
--header 'X-Api-Key: PMAK-614b43d3xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--data @collection.json
then I get an error (see below).
{ "error": { "name": "malformedRequestError", "message": "Found 120 errors with the supplied collection.",
"details": [
"item/2: must have required property 'request'",
"item/2/item/0: must have required property 'request'",
"item/2/item/0/item/0: must have required property 'request'",
"item/2/item/0/item/0/item/8/request/auth: must be null",
"item/2/item/0/item/0/item/8/request/auth/basic: must be array", <<<-------- ????
"item/2/item/0/item/0/item/8/request/auth: must match exactly one schema in oneOf",
"item/2/item/0/item/0/item/8/request: must be string",
"item/2/item/0/item/0/item/8/request: must match exactly one schema in oneOf",
"item/2/item/0/item/0/item/8: must have required property 'item'",
"item/2/item/0/item/0/item/8: must match a schema in anyOf",
"item/2/item/0/item/0: must match a schema in anyOf",
....
Error is truncated but all other messages are similar to provided fragment. It seems that there are some issues with validation of basic auth format.
Notes: item/2/item/0/item/0 are folder items while item/8 is the request item. Corresponding part of imported collection is shown on screenshot. (Sorry, cannot share whole collection because it contains sensitive data)

When I import the same collection with postman app I dont have any errors and collection imported succesfully. BUT (see screenshots) I lost credentials for basic auth in some requests.

@kool79 Looks like the payload is collection v2 format while the API is expecting v2.1. Can you try updating the basic key with the following value:
[
{
"key": "password",
"value": "test",
"type": "string"
},
{
"key": "username",
"value": "test",
"type": "string"
}
]
For more info about the collection schemas, you can refer to this: https://schema.postman.com/
@shubhbhargav Thanks, for help. Seems it is our issue when we merge collections in manual way (as jsons): in header we have v2.1 but below there is a v2.0 format. Current issue can be closed.
Closing the issue as suggested!