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

globals handling needs to be more intelligent #569

Closed
mykhaylo- opened this issue Aug 25, 2016 · 2 comments
Closed

globals handling needs to be more intelligent #569

mykhaylo- opened this issue Aug 25, 2016 · 2 comments
Assignees
Milestone

Comments

@mykhaylo-
Copy link

mykhaylo- commented Aug 25, 2016

I'm using postman 3.1 beta with fix for #537 . Now globals are exported. But when I use exported globals in next newman run exported globals file looks weird.
Here are globals I've got after first run:

{
  "values": [
    {
      "id": "gl1",
      "name": "gl1",
      "value": "I am global",
      "type": "text"
    }
  ],
  "_postman_exported_at": "2016-08-25T16:19:11.409Z",
  "_postman_exported_using": "Newman/3.1.0-beta.1"
}

Then I run the collection second time with feeding previous file as globals and exporting into new file. What I've got:

{
  "values": [
    {
      "id": "values",
      "name": "values",
      "value": [
        {
          "id": "gl1",
          "name": "gl1",
          "value": "I am global",
          "type": "text"
        }
      ],
      "type": "text"
    },
    {
      "id": "_postman_exported_at",
      "name": "_postman_exported_at",
      "value": "2016-08-25T16:19:11.409Z",
      "type": "text"
    },
    {
      "id": "_postman_exported_using",
      "name": "_postman_exported_using",
      "value": "Newman/3.1.0-beta.1",
      "type": "text"
    },
    {
      "id": "gl1",
      "name": "gl1",
      "value": "I am global",
      "type": "text"
    }
  ],
  "_postman_exported_at": "2016-08-25T16:19:34.305Z",
  "_postman_exported_using": "Newman/3.1.0-beta.1"
}

Looks like after second run I've got not only "gl1" but also "_postman_exported_using", "_postman_exported_at" and "values".

I think the reason is that newman allows to specify globals in arbitrary JSON format and all properties of root JSON object are taken as globals. As result even native newman format for environments is parsed as arbitrary data. I think it can be implemented more intelligently. Newman can recognize that passed JSON is generated by newman It can be achieved for example by checking for _postman_exported_at or _postman_exported_using properties or maybe by introducing some special property which says "I am newman environment object, please process me accordingly". And if it is recognized, simply use values as env properties, otherwise use existing approach with arbitrary JSON data.

@kunagpal
Copy link
Contributor

This has been fixed in #697, and shall be rolled out in a future Newman release.

@kunagpal
Copy link
Contributor

This issue has been fixed in Newman v3.2.0, do give it a spin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants