Skip to content

Instantly share code, notes, and snippets.

@philsturgeon

philsturgeon/wtf.md

Last active Dec 7, 2017
Embed
What would you like to do?
Postman disagrees with itself

Hey, I’m super lost.

Currently im trying to make API Flow work:

https://github.com/luckymarmot/API-Flow/issues/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

This comment has been minimized.

Copy link

@nigel-binaryio nigel-binaryio commented Dec 6, 2017

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
You can’t perform that action at this time.