Exp: Pull examples from object schema props #10541
Annotations
10 errors and 1 warning
Test:
tests/unit/documentation.spec.ts#L42
Error: Snapshot `Documentation > Basic cases > should generate the correct schema of example routing 0 1` mismatched
- Expected
+ Received
@@ -116,33 +116,38 @@
in: path
required: true
description: PATCH /v1/user/:id Parameter
schema:
type: string
- examples:
- example1:
+ examples:
- value: "12"
+ - "12"
requestBody:
description: PATCH /v1/user/:id Request body
content:
application/json:
schema:
type: object
properties:
key:
type: string
minLength: 1
+ examples:
+ - 1234-5678-90
name:
type: string
minLength: 1
+ examples:
+ - John Doe
birthday:
description: YYYY-MM-DDTHH:mm:ss.sssZ
type: string
format: date-time
pattern: ^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?)?Z?$
externalDocs:
url: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
+ examples:
+ - 1963-04-21
required:
- key
- name
- birthday
examples:
@@ -168,16 +173,20 @@
data:
type: object
properties:
name:
type: string
+ examples:
+ - John Doe
createdAt:
description: YYYY-MM-DDTHH:mm:ss.sssZ
type: string
format: date-time
externalDocs:
url: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
+ examples:
+ - 2021-12-31T00:00:00.000Z
required:
- name
- createdAt
examples:
- name: John Doe
❯ tests/unit/documentation.spec.ts:42:22
|
Test:
tests/unit/documentation.spec.ts#L42
Error: Snapshot `Documentation > Basic cases > should generate the correct schema of example routing 1 1` mismatched
- Expected
+ Received
@@ -65,13 +65,10 @@
in: path
required: true
description: PATCH /v1/user/:id Parameter
schema:
$ref: "#/components/schemas/PatchV1UserIdParameterId"
- examples:
- example1:
- value: "12"
requestBody:
description: PATCH /v1/user/:id Request body
content:
application/json:
schema:
@@ -394,10 +391,12 @@
type: string
pattern: \d+
description: numeric string
PatchV1UserIdParameterId:
type: string
+ examples:
+ - "12"
PatchV1UserIdPositiveResponse:
type: object
properties:
status:
type: string
@@ -405,16 +404,20 @@
data:
type: object
properties:
name:
type: string
+ examples:
+ - John Doe
createdAt:
description: YYYY-MM-DDTHH:mm:ss.sssZ
type: string
format: date-time
externalDocs:
url: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
+ examples:
+ - 2021-12-31T00:00:00.000Z
required:
- name
- createdAt
examples:
- name: John Doe
@@ -442,20 +445,26 @@
type: object
properties:
key:
type: string
minLength: 1
+ examples:
+ - 1234-5678-90
name:
type: string
minLength: 1
+ examples:
+ - John Doe
birthday:
description: YYYY-MM-DDTHH:mm:ss.sssZ
type: string
format: date-time
pattern: ^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?)?Z?$
externalDocs:
url: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
+ examples:
+ - 1963-04-21
required:
- key
- name
- birthday
PostV1UserCreatePositiveResponse201:
❯ tests/unit/documentation.spec.ts:42:22
|
Test:
tests/unit/documentation.spec.ts#L124
Error: Snapshot `Documentation > Basic cases > should generate the correct schema for nullable and optional types 1` mismatched
- Expected
+ Received
@@ -11,25 +11,31 @@
in: query
required: false
description: GET /v1/getSomething Parameter
schema:
type: string
+ examples:
+ example1: {}
- name: optDefault
in: query
required: false
description: GET /v1/getSomething Parameter
schema:
type: string
default: test
+ examples:
+ example1: {}
- name: nullish
in: query
required: false
description: GET /v1/getSomething Parameter
schema:
type:
- boolean
- "null"
+ examples:
+ example1: {}
- name: nuDefault
in: query
required: false
description: GET /v1/getSomething Parameter
schema:
@@ -38,10 +44,12 @@
- "null"
format: int64
exclusiveMinimum: 0
maximum: 9007199254740991
default: 123
+ examples:
+ example1: {}
responses:
"200":
description: GET /v1/getSomething Positive response
content:
application/json:
❯ tests/unit/documentation.spec.ts:124:20
|
Test:
tests/unit/documentation.spec.ts#L235
Error: Snapshot `Documentation > Basic cases > should generate the correct schema for discriminated union type 1` mismatched
- Expected
+ Received
@@ -32,10 +32,13 @@
b:
type: string
required:
- type
- b
+ examples:
+ example1:
+ value: {}
responses:
"200":
description: POST /v1/getSomething Positive response
content:
application/json:
❯ tests/unit/documentation.spec.ts:235:20
|
Test:
tests/unit/documentation.spec.ts#L321
Error: Snapshot `Documentation > Basic cases > should handle record 1` mismatched
- Expected
+ Received
@@ -10,10 +10,13 @@
description: POST /v1/getSomething Request body
content:
application/json:
schema:
type: object
+ examples:
+ example1:
+ value: {}
responses:
"200":
description: POST /v1/getSomething Positive response
content:
application/json:
❯ tests/unit/documentation.spec.ts:321:20
|
Test:
tests/unit/documentation.spec.ts#L344
Error: Snapshot `Documentation > Basic cases > should handle type any 1` mismatched
- Expected
+ Received
@@ -11,10 +11,12 @@
in: query
required: false
description: GET /v1/getSomething Parameter
schema:
format: any
+ examples:
+ example1: {}
responses:
"200":
description: GET /v1/getSomething Positive response
content:
application/json:
@@ -27,13 +29,20 @@
data:
type: object
properties:
any:
format: any
- required:
- - status
- - data
+ examples:
+ - {}
+ required:
+ - status
+ - data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: GET /v1/getSomething Negative response
content:
application/json:
schema:
❯ tests/unit/documentation.spec.ts:344:20
|
Test:
tests/unit/documentation.spec.ts#L497
Error: Snapshot `Documentation > Basic cases > should handle z.preprocess() 1` mismatched
- Expected
+ Received
@@ -37,13 +37,21 @@
properties:
boolean:
type:
- boolean
- "null"
- required:
- - status
- - data
+ examples:
+ - boolean: false
+ required:
+ - status
+ - data
+ examples:
+ example1:
+ value:
+ status: success
+ data:
+ boolean: false
"400":
description: GET /v1/getSomething Negative response
content:
application/json:
schema:
❯ tests/unit/documentation.spec.ts:497:20
|
Test:
tests/unit/documentation.spec.ts#L655
Error: Snapshot `Documentation > Basic cases > should ensure uniq security schema names 1` mismatched
- Expected
+ Received
@@ -79,10 +79,13 @@
description: POST /v1/setSomething Request body
content:
application/json:
schema:
type: object
+ examples:
+ example1:
+ value: {}
security:
- HTTP_1: []
OAUTH2_1:
- write
responses:
@@ -96,13 +99,20 @@
status:
type: string
const: success
data:
type: object
- required:
- - status
- - data
+ examples:
+ - {}
+ required:
+ - status
+ - data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: POST /v1/setSomething Negative response
content:
application/json:
schema:
@@ -134,10 +144,13 @@
description: PUT /v1/updateSomething Request body
content:
application/json:
schema:
type: object
+ examples:
+ example1:
+ value: {}
security:
- HTTP_2: []
responses:
"200":
description: PUT /v1/updateSomething Positive response
@@ -149,13 +162,20 @@
status:
type: string
const: success
data:
type: object
+ examples:
+ - {}
required:
- status
- data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: PUT /v1/updateSomething Negative response
content:
application/json:
schema:
❯ tests/unit/documentation.spec.ts:655:20
|
Test:
tests/unit/documentation.spec.ts#L681
Error: Snapshot `Documentation > Basic cases > should ensure the uniq operation ids 1` mismatched
- Expected
+ Received
@@ -19,13 +19,20 @@
status:
type: string
const: success
data:
type: object
+ examples:
+ - {}
required:
- status
- data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: GET /v1/getSome/thing Negative response
content:
application/json:
schema:
@@ -66,13 +73,20 @@
status:
type: string
const: success
data:
type: object
+ examples:
+ - {}
required:
- status
- data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: GET /v1/getSome/:thing Negative response
content:
application/json:
schema:
❯ tests/unit/documentation.spec.ts:681:20
|
Test:
tests/unit/documentation.spec.ts#L705
Error: Snapshot `Documentation > Basic cases > should be able to specify operation 1` mismatched
- Expected
+ Received
@@ -19,13 +19,20 @@
status:
type: string
const: success
data:
type: object
+ examples:
+ - {}
required:
- status
- data
+ examples:
+ example1:
+ value:
+ status: success
+ data: {}
"400":
description: GET /v1/getSome/thing Negative response
content:
application/json:
schema:
❯ tests/unit/documentation.spec.ts:705:20
|
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
Loading