Skip to content

Commit 06e5425

Browse files
Merge pull request #249 from cerberauth/make-fake-body-more-robust
tests: add more openapi fake body tests
2 parents 8943fb3 + 00627e1 commit 06e5425

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

openapi/param_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,26 @@ func TestGetSchemaValue_RequestBodyParameters(t *testing.T) {
272272
name: "object with array",
273273
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object, properties: {name: {type: array, items: {type: string}}}}}}}, responses: {'204': {}}}}}}`,
274274
},
275+
{
276+
name: "object with array with 10 depth properties",
277+
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object, properties: {name: {type: array, items: {type: object, properties: {subname: {type: array, items: {type: object, properties: {subsubname: {type: array, items: {type: object, properties: {subsubsubname: {type: array, items: {type: object, properties: {subsubsubsubname: {type: array, items: {type: object, properties: {subsubsubsubsubname: {type: array, items: {type: object, properties: {subsubsubsubsubsubname: {type: array, items: {type: object, properties: {subsubsubsubsubsubsubname: {type: array, items: {type: object, properties: {subsubsubsubsubsubsubsubname: {type: array, items: {type: object, properties: {subsubsubsubsubsubsubsubsubname: {type: array, items: {type: string }}} }}} }}} }}} }}} }}} }}} }}} }}} }}}}}}}}, responses: {'204': {}}}}}}`,
278+
},
275279
{
276280
name: "object with object",
277281
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object, properties: {name: {type: object, properties: {subname: {type: string}}}}}}}}, responses: {'204': {}}}}}}`,
278282
},
283+
{
284+
name: "object with missing properties",
285+
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object}}}}, responses: {'204': {}}}}}}`,
286+
},
287+
{
288+
name: "object with 4 depth properties",
289+
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object, properties: {name: {type: object, properties: {subname: {type: object, properties: {subsubname: {type: object, properties: {subsubsubname: {type: string}}}}}}}}}}}}, responses: {'204': {}}}}}}`,
290+
},
291+
{
292+
name: "object with 10 depth properties",
293+
schema: `{openapi: 3.0.2, servers: [{url: 'http://localhost:8080'}], paths: {/: {post: {requestBody: {content: {'application/json': {schema: {type: object, properties: {name: {type: object, properties: {subname: {type: object, properties: {subsubname: {type: object, properties: {subsubsubname: {type: object, properties: {subsubsubsubname: {type: object, properties: {subsubsubsubsubname: {type: object, properties: {subsubsubsubsubsubname: {type: object, properties: {subsubsubsubsubsubsubname: {type: object, properties: {subsubsubsubsubsubsubsubname: {type: object, properties: {subsubsubsubsubsubsubsubsubname: {type: string }}} }}}}}}}}}}}}}}}}}}}}}}}, responses: {'204': {}}}}}}`,
294+
},
279295
}
280296

281297
for _, tt := range tests {

0 commit comments

Comments
 (0)