Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/schemas/validation/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ $defs:
requestBody: true
description:
type: string
body:
server:
$ref: '#/$defs/server'
oneOf:
- required:
Expand Down
30 changes: 30 additions & 0 deletions tests/schema/pass/callback-object-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
openapi: 3.1.0
info:
title: API
version: 1.0.0
components:
callbacks:
myCallback:
'{$request.query.queryUrl}':
post:
requestBody:
description: Callback payload
content:
application/json:
schema:
$ref: '#/components/schemas/SomePayload'
responses:
'200':
description: callback successfully processed
transactionCallback:
'http://notificationServer.com?transactionId={$request.body#/id}&email={$request.body#/email}':
post:
requestBody:
description: Callback payload
content:
application/json:
schema:
$ref: '#/components/schemas/SomePayload'
responses:
'200':
description: callback successfully processed
71 changes: 71 additions & 0 deletions tests/schema/pass/components-object-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
openapi: 3.1.0
info:
title: API
version: 1.0.0
components:
schemas:
GeneralError:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
Category:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
Tag:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
parameters:
skipParam:
name: skip
in: query
description: number of items to skip
required: true
schema:
type: integer
format: int32
limitParam:
name: limit
in: query
description: max records to return
required: true
schema:
type: integer
format: int32
responses:
NotFound:
description: Entity not found.
IllegalInput:
description: Illegal input for operation.
GeneralError:
description: General Error
content:
application/json:
schema:
$ref: '#/components/schemas/GeneralError'
securitySchemes:
api_key:
type: apiKey
name: api-key
in: header
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://example.org/api/oauth/dialog
scopes:
write:pets: modify pets in your account
read:pets: read your pets
63 changes: 63 additions & 0 deletions tests/schema/pass/example-object-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
openapi: 3.1.0
info:
title: API
version: 1.0.0
components:
requestBodies:
with-example:
content:
'application/json':
schema:
$ref: '#/components/schemas/Address'
examples:
foo:
summary: A foo example
value:
foo: bar
bar:
summary: A bar example
value:
bar: baz
application/xml:
examples:
xmlExample:
summary: This is an example in XML
externalValue: https://example.org/examples/address-example.xml
text/plain:
examples:
textExample:
summary: This is a text example
externalValue: https://foo.bar/examples/address-example.txt
parameters:
with-example:
name: zipCode
in: query
schema:
type: string
format: zip-code
examples:
zip-example:
$ref: '#/components/examples/zip-example'
responses:
'200':
description: your car appointment has been booked
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
examples:
confirmation-success:
$ref: '#/components/examples/confirmation-success'
application/x-www-form-urlencoded:
schema:
type: object
properties:
jsonValue:
type: string
encoding:
jsonValue:
contentType: application/json
examples:
jsonFormValue:
description: 'The JSON string "json" as a form value'
value: jsonValue=%22json%22
25 changes: 25 additions & 0 deletions tests/schema/pass/header-object-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
openapi: 3.1.0
info:
title: API
version: 1.0.0
components:
headers:
X-Rate-Limit-Limit:
description: The number of allowed requests in the current period
deprecated: false
schema:
type: integer
ETag:
required: true
content:
text/plain:
schema:
type: string
pattern: ^"
Reference:
$ref: '#/components/schemas/ETag'
Style:
schema:
type: array
style: simple
explode: true
19 changes: 19 additions & 0 deletions tests/schema/pass/info-object-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# including External Documentation Object Example
openapi: 3.1.0
info:
title: Example Pet Store App
summary: A pet store manager.
description: This is an example server for a pet store.
termsOfService: https://example.com/terms/
contact:
name: API Support
url: https://www.example.com/support
email: [email protected]
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.1
externalDocs:
description: Find more info here
url: https://example.com
components: {}
62 changes: 62 additions & 0 deletions tests/schema/pass/link-object-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/users/{id}:
parameters:
- name: id
in: path
required: true
description: the user identifier, as userId
schema:
type: string
get:
responses:
'200':
description: the user being returned
content:
application/json:
schema:
type: object
properties:
uuid: # the unique user id
type: string
format: uuid
links:
address:
# the target link operationId
operationId: getUserAddress
parameters:
# get the `id` field from the request path parameter named `id`
userid: $request.path.id
address2:
operationId: getUserAddressByUUID
parameters:
# get the `uuid` field from the `uuid` field in the response body
userUuid: $response.body#/uuid
UserRepositories:
# returns array of '#/components/schemas/repository'
operationRef: '#/paths/~12.0~1repositories~1%7Busername%7D/get'
parameters:
username: $response.body#/username
UserRepositories2:
# returns array of '#/components/schemas/repository'
operationRef: https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1%7Busername%7D/get
parameters:
username: $response.body#/username
# the path item of the linked operation
/users/{userid}/address:
parameters:
- name: userid
in: path
required: true
description: the user identifier, as userId
schema:
type: string
# linked operation
get:
operationId: getUserAddress
responses:
'200':
description: the user's address
97 changes: 97 additions & 0 deletions tests/schema/pass/media-type-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# including Encoding Object examples
openapi: 3.1.0
info:
title: API
version: 1.0.0
paths:
/something:
put:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
examples:
cat:
summary: An example of a cat
value:
name: Fluffy
petType: Cat
color: White
gender: male
breed: Persian
dog:
summary: An example of a dog with a cat's name
value:
name: Puma
petType: Dog
color: Black
gender: Female
breed: Mixed
frog:
$ref: '#/components/examples/frog-example'
application/x-www-form-urlencoded:
schema:
type: object
properties:
id:
type: string
format: uuid
address:
# complex types are stringified to support RFC 1866
type: object
properties: {}
icon:
# The default with "contentEncoding" is application/octet-stream,
# so we need to set image media type(s) in the Encoding Object.
type: string
contentEncoding: base64url
encoding:
icon:
contentType: image/png, image/jpeg
multipart/form-data:
schema:
type: object
properties:
id:
# default is `text/plain`
type: string
format: uuid
addresses:
# default based on the `items` subschema would be
# `application/json`, but we want these address objects
# serialized as `application/xml` instead
description: addresses in XML format
type: array
items:
$ref: '#/components/schemas/Address'
profileImage:
# default is application/octet-stream, but we can declare
# a more specific image type or types
type: string
format: binary
forCoverage:
type: string
forCoverage2:
type: string
encoding:
addresses:
# require XML Content-Type in utf-8 encoding
# This is applied to each address part corresponding
# to each address in he array
contentType: application/xml; charset=utf-8
profileImage:
# only accept png or jpeg
contentType: image/png, image/jpeg
headers:
X-Rate-Limit-Limit:
description: The number of allowed requests in the current period
schema:
type: integer
forCoverage:
style: form
explode: false
allowReserved: true
forCoverage2:
style: spaceDelimited
explode: true
Loading