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

url not correctly imported #18

Closed
blackat opened this issue Jan 16, 2019 · 2 comments
Closed

url not correctly imported #18

blackat opened this issue Jan 16, 2019 · 2 comments

Comments

@blackat
Copy link

blackat commented Jan 16, 2019

Describe the bug
URL is not correctly imported when path templating is used.

Imported

{{protocol}}://{host}:{port}/:contextpath/{restapi}/models/:id

JSON file

"servers" : [ {
    "url" : "{protocol}://{host}:{port}/{contextpath}/{restapi}",
}]

It is not clear how the placeholders are resolve and hence how to define the environment to apply them.

Expected behavior
I expect to have the same placeholders to be use in the environment definition.

Screenshot
postman

Update

{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "My Rest API",
    "description" : "My RESTful API implementation",
    "version" : "1.0.0"
  },
  "servers" : [ {
    "url" : "{server-url}/api",
    "description" : "My REST API",
    "variables" : {
      "server-url" : {
        "default" : "http://localhost:8080/my-war",
        "enum" : [ "" ]
      }
    }
  }

I have tried to use just one placeholder in the url path templating, once imported in Postman I get {server-url}/api/models with only one { and not two {{server-url}} so that it can be interpolated with the defined environment variable.

@numaanashraf numaanashraf transferred this issue from postmanlabs/postman-app-support Jan 17, 2019
@abhijitkane
Copy link
Member

@blackat Since the OpenAPI converter now saves the server URL as a collection variable, we can only use the environment variable syntax while importing.

eg. a server.url of {protocol}://{host}:{port}/{contextpath}/{restapi} converts to {{protocol}}://{{host}}:{{port}}/{{contextpath}}/{{restapi}} in Postman.

PR: https://github.com/postmanlabs/openapi-to-postman/pull/60/files

@blackat
Copy link
Author

blackat commented May 19, 2019

I will check again.
Thanks fo your answer

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

2 participants