You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug description
When you define collection variables and export the collection as v2.0 or v2.1 schema formats they do not pass schema validation tests. The issue seems to be that the variables "type" field is not in the accepted list as per the schema.
"type": {
"description": "A variable may have multiple types. This field specifies the type of the variable.",
"type": "string",
"enum": [
"string",
"boolean",
"any",
"number"
]
},
However a collection exported from the postman app sets all variables to type "default" from my experience. I have not found a way to edit the types of these variables native to the application.
Steps to Reproduce
Create a postman collection on the app
Add some collection level variable
Save the collection and export it as v2.0 or v2.1
Run a schema validation against it to see the failure (python code provided below)
Edit the exported schema file - at the bottom find your collection variable(s) - change the "type" field for each of the variables to one of the allowed types (string, boolean, any, number)
Run a schema validation against it
Expected Behavior
An exported postman collection should pass a schema validation check.
Validation Code
import requests # make sure this is installed
from jsonschema import validate
from jsonschema.exceptions import ValidationError
import json
schema = requests.get('https://schema.postman.com/collection/json/v2.1.0/draft-07/collection.json').json()
with open("C:\\Users\\matt\\Downloads\\Demo.postman_collection.json", 'r') as f:
test_input = json.load(f)
print(test_input)
try:
validate(test_input, schema)
except ValidationError:
print('It is not a valid collection!')
else:
print('It is a valid collection!')
Attachments
I have attached two postman collections, the one tagged with 'fixed' has the type fields edited. It will pass the schema validation.
Bug description
When you define collection variables and export the collection as v2.0 or v2.1 schema formats they do not pass schema validation tests. The issue seems to be that the variables "type" field is not in the accepted list as per the schema.
From: https://schema.postman.com/collection/json/v2.1.0/draft-07/collection.json (L1058):
However a collection exported from the postman app sets all variables to type "default" from my experience. I have not found a way to edit the types of these variables native to the application.
Steps to Reproduce
Expected Behavior
An exported postman collection should pass a schema validation check.
Validation Code
Attachments
I have attached two postman collections, the one tagged with 'fixed' has the type fields edited. It will pass the schema validation.
Demo.postman_collection.json
Demo.postman_collection_fixed.json
The text was updated successfully, but these errors were encountered: