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

Item events are not exported in the proper schema #1256

Open
atedesch1 opened this issue Mar 15, 2022 · 2 comments
Open

Item events are not exported in the proper schema #1256

atedesch1 opened this issue Mar 15, 2022 · 2 comments

Comments

@atedesch1
Copy link

atedesch1 commented Mar 15, 2022

If an Item is created with the field events instead of adding events after the object is created, when you try to run the collection that contains it with newman it doesn't recognize this field and instead the actual object if printed to json has the event field as an empty array.

Example:

const col = new Collection({
    name: "New Collection",
});

col.items.add(new Item({
    name: "Test",
    events: [
        new Event({
            listen: "test",
            script: new Script({
                exec: "console.log(\"Doesnt work\")"
            })
        })
    ],
    request: new Request({
        method: "GET",
        url: "https://postman-echo.com/delay/5"
    })
}));

When printed to json:

{
  "item": [
    {
      "id": "bf62b129-06ab-4c3c-9ca5-28d3ec901d4a",
      "name": "Test",
      "request": {
        "url": {
          "protocol": "https",
          "path": ["delay", "5"],
          "host": ["postman-echo", "com"],
          "query": [
            { "key": "members", "value": [] },
            { "key": "reference", "value": {} },
            {
              "key": "Type",
              "value": {
                "_postman_propertyName": "QueryParam",
                "_postman_propertyIndexKey": "key",
                "_postman_propertyAllowsMultipleValues": true
              }
            },
            { "key": "_postman_listIndexKey", "value": "key" },
            { "key": "_postman_listAllowsMultipleValues", "value": true }
          ],
          "variable": []
        },
        "method": "GET"
      },
      "response": [],
      "event": []
    }
  ],
  "event": [],
  "variable": [],
  "info": {
    "_postman_id": "8402828d-2eae-46a1-9cc3-897278812bef",
    "name": "New Collection",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  }
}

Also, if you add the Item as any and instead of the field events you use event, everything works fine.

The problem is ItemDefinition type has the field events instead of event

@ANKITSINGH065
Copy link

ANKITSINGH065 commented Jun 18, 2023

The issue you're experiencing seems to be related to the specific implementation or version of the library or framework you're using, rather than a fundamental problem with the concept itself. Without more information about the context and the specific library or framework you're using,
However, based on the code snippet you provided, it appears that you're creating a collection with an item and assigning an array of events to the events field of the item. However, when you print the collection to JSON, the event field of the item is empty. It's important to note that the Item class or definition you're using might differ depending on the library or framework.

To troubleshoot this issue, you can consider the following steps:

  1. Ensure that you are using the correct syntax and API calls for your library or framework to define and add events to an item. Consult the documentation or examples provided by the library or framework to verify the correct usage.

  2. Double-check that you are using the latest version of the library or framework, as newer versions might include bug fixes or improvements related to events or collections.

  3. Check if there are any reported issues or discussions related to events in the library or framework's issue tracker or community forums. It's possible that others have encountered similar problems and found workarounds or solutions.

  4. If you're still unable to resolve the issue, consider reaching out to the library or framework's support channels for assistance. They will have the most accurate and up-to-date information about the specific implementation you're using.

@atedesch1

@ANKITSINGH065
Copy link

which json file this bug is occur. can you give link @atedesch1

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