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

collection v2.1.0 #3

Open
wahmedswl opened this issue Feb 14, 2018 · 6 comments
Open

collection v2.1.0 #3

wahmedswl opened this issue Feb 14, 2018 · 6 comments

Comments

@wahmedswl
Copy link

Hi,
Tried to convert latest postman collection via dakiya, it seems like its broken. Any help would be appreciated.

Latest schema definitions are available https://schema.getpostman.com/json/collection/v2.1.0/collection.json

Thanks

@rupeshmore
Copy link
Owner

@wahmedswl
Can you provide the error details?
Open the browser console and you should be able to see the error.
In the meantime, I will investigate using the latest schema example

@wahmedswl
Copy link
Author

Hi,
There was issue in URL parsing

dakiya.js:139 Uncaught TypeError: urlObj.host.replace is not a function
    at transformRequestData (dakiya.js:139)
    at filterPostmanItems (dakiya.js:123)
    at dakiya.js:82
    at Array.forEach (<anonymous>)
    at processPostmanItem (dakiya.js:81)
    at filterPostmanJson (dakiya.js:74)
    at FileReader.reader.onload (dakiya.js:51)

@rupeshmore
Copy link
Owner

@wahmedswl
From the error, it is evident that the "host" within the collection is not a string.
Check your postman collection if the host value is a string as per the following example.

If the above is not an issue, can you check if your postman collection JSON is valid? To validate you can go to https://jsonformatter.curiousconcept.com/

Example:

"item": [
    {
        "id": "request-404",
        "name": "404 not found",
        "request": {
            "description": {
                "content": "Some stuff I want to say about this request. It's in *markdown* too.",
            },
            "url": {
                "description": "This is a nice URL.",
                "protocol": "https",
                "port": "8443",
                "path": "path/to/document",
                "host": "sub.example.com."
            },
        }
    }
]
```

@wahmedswl
Copy link
Author

@rupeshmore yeah, its collection with variables

{
	"info": {
		"name": "PostmanCollection",
		"_postman_id": "0499d638-96b3-81a3-9620-6cbedd750b4b",
		"description": "",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "{{API_URL}}/api/login",
			"request": {
				"method": "POST",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": "user=john.doe@email.com&password=pwd4jOhnDo3"
				},
				"url": {
					"raw": "{{API_URL}}/api/login",
					"host": [
						"{{API_URL}}"
					],
					"path": [
						"api",
						"login"
					]
				},
				"description": ""
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"id": "9308e64b-d915-402a-be1e-37e9b3b7cede",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"id": "efcee822-d514-4b8e-b57a-a45b82b65cf7",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"id": "7a7c362a-0272-4713-b38a-8302f61363d4",
			"key": "API_URL",
			"value": "http://localhost/pm-api",
			"type": "text"
		}
	]
}

@rupeshmore
Copy link
Owner

@wahmedswl
For you to move forward, I would request to update your collection JSON schema from

"host": [
	"{{API_URL}}"
],

to

"host": "{{API_URL}}",

This will get rid of the errors you have using dakiya.
I have started updating my code to include this fix. Should be done in next couple of days.

@infowolfe
Copy link

I should also note that this also occurs with "mode": "raw" in postman v2.0 format schema, which seems (in current versions of postman) to occur whenever attempting a GET or DELETE request (minimally).

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

3 participants