Example (#4730)
* add tests for example feature * refactor ParameterRow value setter logic * aside: fix property access in sampleFromSchema * prioritize media type examples for OAS3 responses * use `example` in schema level example * refactor: move stringify to utils * prioritize media type examples in OAS3 request bodies * modify nightwatch config * fix parameter/response regressions * reorder and broaden default value sources * update lockfile
This commit is contained in:
156
test/e2e/specs/features/example.openapi.yaml
Normal file
156
test/e2e/specs/features/example.openapi.yaml
Normal file
@@ -0,0 +1,156 @@
|
||||
openapi: 3.0.0
|
||||
servers:
|
||||
- url: http://example.com/v1
|
||||
description: Production server version 1
|
||||
- url: http://staging-api.example.com
|
||||
description: Staging server
|
||||
info:
|
||||
description: |
|
||||
This is an API documentation of example.
|
||||
version: "0.1.0"
|
||||
title: Example
|
||||
termsOfService: 'http://www.example.com/terms/'
|
||||
contact:
|
||||
email: developer@example.com
|
||||
license:
|
||||
name: Proprietary license
|
||||
url: 'http://www.example.com/license/'
|
||||
tags:
|
||||
- name: agent
|
||||
description: Access to example
|
||||
paths:
|
||||
/agents/{agentId}:
|
||||
put:
|
||||
tags:
|
||||
- agent
|
||||
summary: Edit agent
|
||||
operationId: editAgent
|
||||
parameters:
|
||||
- in: path
|
||||
name: agentId
|
||||
schema:
|
||||
type: integer
|
||||
example: 12345
|
||||
required: true
|
||||
description: Numeric ID of the paper agent to edit
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json_media-type-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: AE1
|
||||
name: Andrew
|
||||
application/json_schema-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: AE1
|
||||
name: Andrew
|
||||
application/json_property-level:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
example: AE1
|
||||
name:
|
||||
type: string
|
||||
example: Andrew
|
||||
responses:
|
||||
'200':
|
||||
description: media type-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: 200
|
||||
payload:
|
||||
- id: 1
|
||||
code: AE2
|
||||
name: Yono
|
||||
'201':
|
||||
description: schema-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
code:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
example:
|
||||
code: 201
|
||||
payload:
|
||||
- id: 1
|
||||
code: AE2
|
||||
name: Yono
|
||||
'202':
|
||||
description: property-level example
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 202
|
||||
payload:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
format: int64
|
||||
readOnly: true
|
||||
example: 1
|
||||
code:
|
||||
type: string
|
||||
example: AE2
|
||||
name:
|
||||
type: string
|
||||
example: Yono
|
||||
Reference in New Issue
Block a user