Skip to content

Instantly share code, notes, and snippets.

@philsturgeon
Last active December 7, 2017 18:44
Show Gist options
  • Save philsturgeon/a901f1212286c8f0d389cda74706bc40 to your computer and use it in GitHub Desktop.
Save philsturgeon/a901f1212286c8f0d389cda74706bc40 to your computer and use it in GitHub Desktop.
Postman disagrees with itself

Hey, I’m super lost.

Currently im trying to make API Flow work:

luckymarmot/API-Flow#149

There is an output.json which is a test case, and accoring to Postmans JSON Schema it is invalid.

I'm fixing a few (headers cannot have a null value) but the auth section is triggering errors. It looks like this:

"auth": {
	"type": "oauth2",
	"oauth2": {
	"authUrl": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
	"scope": "write_pets read_pets"
}

According to the Postman Collection v2.1.0 schema, I changed it to this:

"auth": {
  "type": "oauth2",
  "oauth2": [
    {
      "key": "authUrl",
      "value": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
      "type": "string"
    },
    {
      "key": "scope",
      "value": "write_pets read_pets",
      "type": "string"
    }
  ]
},

This passes JSON Schema validation, but when I import to Postman (to test the syntax is definitely what we want), it seems to be missing from the interface.

Then I see this in the exported json:

"auth": {
	"type": "oauth2",
	"oauth2": [
		{
			"key": "0",
			"value": {
				"key": "authUrl",
				"value": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
				"type": "string"
			},
			"type": "any"
		},
		{
			"key": "1",
			"value": {
				"key": "scope",
				"value": "write_pets read_pets",
				"type": "string"
			},
			"type": "any"
		}
	]
},

So, either the JSON Schema provided by Postman is telling me to do something invalid, or Postman the client is not supporting Postman's JSON Schema... or I'm doing something wrong in between and should go to bed.

What is happening.

@nigel-binaryio
Copy link

I think the problem is you are drunk and Postman is off the reservation?

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