Skip to content

Commit b8f26e2

Browse files
authored
Merge pull request #572 from postmanlabs/fix/inputValidationNull
Avoid validation to throw with null info
2 parents 0a4393b + 4be806f commit b8f26e2

11 files changed

+918
-2
lines changed

lib/swaggerUtils/inputValidationSwagger.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
const _ = require('lodash');
32
module.exports = {
43

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"version": "1.0.0",
5+
"title": null
6+
},
7+
"version": "v1.0",
8+
"title": "API",
9+
"servers": [
10+
{
11+
"url": "http://localhost:3000"
12+
}
13+
],
14+
"paths": {
15+
"/user": {
16+
"get": {
17+
"summary": "Returns details about a particular user",
18+
"operationId": "listUser",
19+
"tags": [
20+
"user"
21+
],
22+
"parameters": [
23+
{
24+
"name": "id",
25+
"in": "query",
26+
"description": "ID of the user",
27+
"required": true,
28+
"schema": {
29+
"type": "integer",
30+
"format": "int32"
31+
}
32+
}
33+
],
34+
"responses": {
35+
"200": {
36+
"description": "Details about a user by ID",
37+
"headers": {
38+
"x-next": {
39+
"description": "A link to the next page of responses",
40+
"schema": {
41+
"type": "string"
42+
}
43+
}
44+
},
45+
"content": {
46+
"application/json": {
47+
"schema": {
48+
"$ref": "\\'#/components/schemas/User\\'"
49+
}
50+
}
51+
}
52+
},
53+
"default": {
54+
"description": "Unexpected error",
55+
"content": {
56+
"application/json": {
57+
"schema": {
58+
"$ref": "\\'#/components/schemas/Error\\'"
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
},
67+
"components": {
68+
"schemas": {
69+
"User": {
70+
"type": "object",
71+
"required": [
72+
"id",
73+
"name"
74+
],
75+
"properties": {
76+
"id": {
77+
"type": "integer",
78+
"format": "int64"
79+
},
80+
"name": {
81+
"type": "string"
82+
},
83+
"tag": {
84+
"type": "string"
85+
}
86+
}
87+
},
88+
"Error": {
89+
"type": "object",
90+
"required": [
91+
"code",
92+
"message"
93+
],
94+
"properties": {
95+
"code": {
96+
"type": "integer",
97+
"format": "int32"
98+
},
99+
"message": {
100+
"type": "string"
101+
}
102+
}
103+
}
104+
}
105+
}
106+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"version": null,
5+
"title": "title"
6+
},
7+
"version": "v1.0",
8+
"title": "API",
9+
"servers": [
10+
{
11+
"url": "http://localhost:3000"
12+
}
13+
],
14+
"paths": {
15+
"/user": {
16+
"get": {
17+
"summary": "Returns details about a particular user",
18+
"operationId": "listUser",
19+
"tags": [
20+
"user"
21+
],
22+
"parameters": [
23+
{
24+
"name": "id",
25+
"in": "query",
26+
"description": "ID of the user",
27+
"required": true,
28+
"schema": {
29+
"type": "integer",
30+
"format": "int32"
31+
}
32+
}
33+
],
34+
"responses": {
35+
"200": {
36+
"description": "Details about a user by ID",
37+
"headers": {
38+
"x-next": {
39+
"description": "A link to the next page of responses",
40+
"schema": {
41+
"type": "string"
42+
}
43+
}
44+
},
45+
"content": {
46+
"application/json": {
47+
"schema": {
48+
"$ref": "\\'#/components/schemas/User\\'"
49+
}
50+
}
51+
}
52+
},
53+
"default": {
54+
"description": "Unexpected error",
55+
"content": {
56+
"application/json": {
57+
"schema": {
58+
"$ref": "\\'#/components/schemas/Error\\'"
59+
}
60+
}
61+
}
62+
}
63+
}
64+
}
65+
}
66+
},
67+
"components": {
68+
"schemas": {
69+
"User": {
70+
"type": "object",
71+
"required": [
72+
"id",
73+
"name"
74+
],
75+
"properties": {
76+
"id": {
77+
"type": "integer",
78+
"format": "int64"
79+
},
80+
"name": {
81+
"type": "string"
82+
},
83+
"tag": {
84+
"type": "string"
85+
}
86+
}
87+
},
88+
"Error": {
89+
"type": "object",
90+
"required": [
91+
"code",
92+
"message"
93+
],
94+
"properties": {
95+
"code": {
96+
"type": "integer",
97+
"format": "int32"
98+
},
99+
"message": {
100+
"type": "string"
101+
}
102+
}
103+
}
104+
}
105+
}
106+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": null,
4+
"version": "v1.0",
5+
"title": "API",
6+
"servers": [
7+
{
8+
"url": "http://localhost:3000"
9+
}
10+
],
11+
"paths": {
12+
"/user": {
13+
"get": {
14+
"summary": "Returns details about a particular user",
15+
"operationId": "listUser",
16+
"tags": [
17+
"user"
18+
],
19+
"parameters": [
20+
{
21+
"name": "id",
22+
"in": "query",
23+
"description": "ID of the user",
24+
"required": true,
25+
"schema": {
26+
"type": "integer",
27+
"format": "int32"
28+
}
29+
}
30+
],
31+
"responses": {
32+
"200": {
33+
"description": "Details about a user by ID",
34+
"headers": {
35+
"x-next": {
36+
"description": "A link to the next page of responses",
37+
"schema": {
38+
"type": "string"
39+
}
40+
}
41+
},
42+
"content": {
43+
"application/json": {
44+
"schema": {
45+
"$ref": "\\'#/components/schemas/User\\'"
46+
}
47+
}
48+
}
49+
},
50+
"default": {
51+
"description": "Unexpected error",
52+
"content": {
53+
"application/json": {
54+
"schema": {
55+
"$ref": "\\'#/components/schemas/Error\\'"
56+
}
57+
}
58+
}
59+
}
60+
}
61+
}
62+
}
63+
},
64+
"components": {
65+
"schemas": {
66+
"User": {
67+
"type": "object",
68+
"required": [
69+
"id",
70+
"name"
71+
],
72+
"properties": {
73+
"id": {
74+
"type": "integer",
75+
"format": "int64"
76+
},
77+
"name": {
78+
"type": "string"
79+
},
80+
"tag": {
81+
"type": "string"
82+
}
83+
}
84+
},
85+
"Error": {
86+
"type": "object",
87+
"required": [
88+
"code",
89+
"message"
90+
],
91+
"properties": {
92+
"code": {
93+
"type": "integer",
94+
"format": "int32"
95+
},
96+
"message": {
97+
"type": "string"
98+
}
99+
}
100+
}
101+
}
102+
}
103+
}

0 commit comments

Comments
 (0)