Add some JSON tests (#39)

This commit is contained in:
mniip 2021-04-23 11:11:20 +03:00 committed by GitHub
parent 241c2eb377
commit 3d2b3f5dba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 273 additions and 0 deletions

View File

@ -0,0 +1,29 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
anyOf:
- enum:
- "foo"
- enum:
- "bar"

View File

@ -0,0 +1,27 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
enum:
- "foo"
- "bar"

View File

@ -0,0 +1 @@
Right: []

View File

@ -0,0 +1 @@
Right: []

View File

@ -0,0 +1,25 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
maximum: 3

View File

@ -0,0 +1,25 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
maximum: 2

View File

@ -0,0 +1,10 @@
Left:
OpenApiPathsStep:
PathStep "/test":
PostStep:
OperationRequestBodyStep:
InlineStep:
MediaTypeStep application/json:
MediaTypeSchema:
ReferencedStep (Reference {getReference = "Test"}):
MaximumFields: MatchingMaximumWeak (Inclusive 2.0) (Inclusive 3.0)

View File

@ -0,0 +1,33 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
required:
- property1
- property2
properties:
property1:
type: string
property2:
type: number
additionalProperties: false

View File

@ -0,0 +1,30 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
required:
- property1
properties:
property1:
type: string
additionalProperties: false

View File

@ -0,0 +1,17 @@
Left:
OpenApiPathsStep:
PathStep "/test":
PostStep:
OperationResponsesStep:
ResponseCodeStep 200:
InlineStep:
ResponseMediaObject application/json:
MediaTypeSchema:
ReferencedStep (Reference {getReference = "Test"}):
PropertiesFields: PropertyNowRequired "property2"
OperationRequestBodyStep:
InlineStep:
MediaTypeStep application/json:
MediaTypeSchema:
ReferencedStep (Reference {getReference = "Test"}):
PropertiesFields: UnexpectedProperty "property2"

View File

@ -0,0 +1,32 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
required:
- property1
properties:
property1:
type: string
property2:
type: number
additionalProperties: false

View File

@ -0,0 +1,33 @@
openapi: "3.0.0"
info:
version: 1.0.0
title: Test
servers:
- url: http://localhost/
paths:
/test:
post:
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
responses:
'200':
description: test
content:
application/json:
schema:
$ref: "#/components/schemas/Test"
components:
schemas:
Test:
required:
- property1
- property2
properties:
property1:
type: string
property2:
type: number
additionalProperties: false

View File

@ -0,0 +1,10 @@
Left:
OpenApiPathsStep:
PathStep "/test":
PostStep:
OperationRequestBodyStep:
InlineStep:
MediaTypeStep application/json:
MediaTypeSchema:
ReferencedStep (Reference {getReference = "Test"}):
PropertiesFields: PropertyNowRequired "property2"