postmanlabs / swagger2-to-postman

Converter for swagger 2.0 JSON to Postman Collection
Apache License 2.0
120 stars 55 forks source link

Outputting '}}' as 'postman_variable_cl/OSE_DB' #29

Open nicoburns opened 6 years ago

nicoburns commented 6 years ago

I have a swagger 2 JSON file containing the following property

"host" : "{{base_url}}"

Unfortunately this is getting converted to {{base_urlpostman_variable_cl/OSE_DB in the imported collection, presumably because a parsing token isn't getting replaced somewhere.

Affects the postman desktop app.

ClimberBear commented 6 years ago

Hi Any workaround/suggestion?

nicoburns commented 6 years ago

@ClimberBear Yes actually, I eventually noticed that changing the variable name to some other values fixed it. So try playing around with some different var names if you can.

ClimberBear commented 6 years ago

Really thanks!!!!


Jose M. Albarrán Socio Director b-Thinking Software Tlfo: +34 616 968 262 e-Mail: jmalbarran@b-Thinking.com LinkedIn: https://es.linkedin.com/in/jmalbarran Also available in WhatsApp, Telegram, Skype (jmalbarran) and Google Hangouts https://hangouts.google.com/call/km5oqrxdtlo3lnawe3svlggrnea

2018-02-15 1:04 GMT+01:00 Nico Burns notifications@github.com:

@ClimberBear https://github.com/climberbear Yes actually, I eventually noticed that changing the variable name to some other values fixed it. So try playing around with some different var names if you can.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/postmanlabs/swagger2-to-postman/issues/29#issuecomment-365786449, or mute the thread https://github.com/notifications/unsubscribe-auth/AWAR72MCEAGaAEdd7VHAwuNPcxMTgYM4ks5tU3SlgaJpZM4Pu0g2 .

mjgoethe commented 6 years ago

This is actually a problem in the most recent version of Postman when importing a Swagger file. It's actually due to the fact that the url.resolve function in Node would previously truncate domain parts at 63 characters and then just sort of assumed the rest belonged as part of the path (which is just kind of bonkers). This is aggravated by the fact that the Postman team chose rather long substitution strings for handling variables. The Node team fixed the issue in this commit. Postman is using a slightly older version of Electron, so it makes sense that it still has this issue. For this repo, you should be able to fix this for yourself by running Node v8.0 or later.

... or you can make your host name variable names 14 characters or less.

The team here might still want to reconsider their approach though, since the resolve function also converts all characters to lowercase, which is problematic for variable names.

jehof commented 6 years ago

This is really a dump error. I use various variables for my host-addresses, like {{gateway}}, {{internalstateservice}}, etc.

The {{gateway}}-variable is handled properly, but {{internalstateservice}} is obscured to {{internalstateservicepostman_variable_cl/OSE_DB. This makes it pretty useless.

I hope that they will fix it soon.