Replies: 12 comments
-
my understanding is that for these environment variables, the rules of javascript variable naming apply. dashes are not permitted in variable names in javascript (the parser will interpret them as a subtraction symbol) and thus are not permitted in environment variable names. By the way, environment variables (as in, in shell or just in general) are not permitted to have dashes either. https://pubs.opengroup.org/onlinepubs/009695299/basedefs/xbd_chap08.html Could you possibly share what the third-party OpenAPI document is so we could take a look and see if there's another way to accomplish this? I'm perplexed why this would have a hyphen in the first place. |
Beta Was this translation helpful? Give feedback.
-
I cannot share it but for example look at this online validator:
|
Beta Was this translation helpful? Give feedback.
-
that's very helpful, thanks. @nijikokun it's to you, then, to make a product decision on how we want to proceed here. We can (internally) probably get away with doing some kind of trickery (replace |
Beta Was this translation helpful? Give feedback.
-
I'm wondering if this is a potential regression from the recent importers work or pre-existing. I know that @develohpanda has put in work around adding support for special characters. #2601 |
Beta Was this translation helpful? Give feedback.
-
Not a regression, I don't think importers were updated to use the new variable format but I will need to confirm. Will get back to you! |
Beta Was this translation helpful? Give feedback.
-
@develohpanda any updates? |
Beta Was this translation helpful? Give feedback.
-
@asyba apologies for the delay, this seems to be the offending code (although the example should read insomnia/packages/insomnia-importers/src/importers/openapi3.js Lines 288 to 298 in bdb4b4e Notes for someone picking this up: The following spec generates a URL with template tags as shown below, but it should prefix the environment variable openapi: 3.0.2
info:
title: Example
version: 0.0.1
servers:
- url: https://example.com/v1
paths:
'/api/{abc-def}':
get:
responses:
'200':
description: Hello - {{ base_url }}/api/{{ abc-def }}
+ {{ base_url }}/api/{{ _['abc-def'] }} You could take inspiration from the template tag generation logic here https://github.com/Kong/insomnia/pull/2601/files#diff-dbf418a3cd4acfc045b064cb1064e5f8cd1b05fc40a86b0b74d0606265176315R62-R70, or you could force a tag to always be generated with bracket notation (eg. |
Beta Was this translation helpful? Give feedback.
-
so what is the status? |
Beta Was this translation helpful? Give feedback.
-
I am facing the same issue when importing collection. I saw that I can update the syntax of referencing the variable to {{_['parameter_name']}} but that adds an additional step for me to import multiple collections. |
Beta Was this translation helpful? Give feedback.
-
We will look into this. |
Beta Was this translation helpful? Give feedback.
-
@ihexxa correct me if I am wrong, we are currently solving for importing environment variables that have a hyphen |
Beta Was this translation helpful? Give feedback.
-
I created an environment variable with symbol "-" and was not able to access it.
I can't create another variable name, this is imported from third-party Open API specification.
Context
OS: Ubuntu 18.04.3 LTS
Insomnia v2021.1.1
Beta Was this translation helpful? Give feedback.
All reactions