joolfe / postman-to-openapi

🛸 Convert postman collection to OpenAPI
MIT License
596 stars 104 forks source link

use variables in url #124

Closed hpl002 closed 3 years ago

hpl002 commented 3 years ago

Perhaps this is already supported, but i cannot seem to make it work 100%

Collections often use variables for configuring domains, but these are seemingly not carried over in the conversion..

Provided that these are made available then it would be possible to template these


{
    "info": {
        ...
    },
    "item": [
        {
            "name": "service",
            "item": [
                {
                    "name": "tokendebug",
                    "event": [
                        ...
                    ],
                    "id": "uuid",
                    "protocolProfileBehavior": {
                        "disableBodyPruning": true
                    },
                    "request": {
                        "method": "GET",
                        "header": [
                            {
                                "key": "Cache-Control",
                                "type": "text",
                                "value": "No--cache"
                            },
                            {
                                "key": "Content-Type",
                                "type": "text",
                                "value": "application/x-www-form-urlencoded"
                            }
                        ],
                        "body": {
                            "mode": "urlencoded",
                            "urlencoded": []
                        },
                        "url": "{{server}}/api/tokendebug"
                    },
                    "response": []
                }
            ],
            "id": "uuid"
        }       
    ],
    "event": [
    ...
    ],
    "variable": [
        {
            "id": "uuid",
            "key": "server",
            "value": "http://localhost:3030"
        }
    ]
}

{{server}}/api/tokendebug should therefore become http://localhost:3030/api/tokendebug

joolfe commented 3 years ago

Hi @hpl002,

There are already a feature request for that in #76

Best regards