Skip to content

Commit 2f764db

Browse files
k2tzumidaveshanley
authored andcommitted
Add comprehensive test cases for this fix.
1 parent 874503b commit 2f764db

2 files changed

Lines changed: 464 additions & 0 deletions

File tree

test_specs/nullable_enum.yaml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
openapi: 3.0.2
2+
info:
3+
title: Nullable Enum Test API
4+
version: 1.0.0
5+
description: Test specification for nullable enum validation
6+
paths:
7+
/status:
8+
get:
9+
summary: Get status with nullable enum
10+
operationId: getStatus
11+
responses:
12+
'200':
13+
description: Successful response
14+
content:
15+
application/json:
16+
schema:
17+
$ref: '#/components/schemas/StatusResponse'
18+
post:
19+
summary: Create status
20+
operationId: createStatus
21+
requestBody:
22+
required: true
23+
content:
24+
application/json:
25+
schema:
26+
$ref: '#/components/schemas/StatusRequest'
27+
responses:
28+
'201':
29+
description: Created
30+
content:
31+
application/json:
32+
schema:
33+
$ref: '#/components/schemas/StatusResponse'
34+
/items:
35+
get:
36+
summary: Get items with nullable enum in array
37+
operationId: getItems
38+
responses:
39+
'200':
40+
description: Successful response
41+
content:
42+
application/json:
43+
schema:
44+
type: array
45+
items:
46+
$ref: '#/components/schemas/Item'
47+
components:
48+
schemas:
49+
StatusResponse:
50+
type: object
51+
required:
52+
- id
53+
properties:
54+
id:
55+
type: integer
56+
format: int64
57+
status:
58+
type: string
59+
description: Status field with nullable enum (no null in enum)
60+
enum:
61+
- active
62+
- inactive
63+
- pending
64+
- archived
65+
nullable: true
66+
priority:
67+
type: string
68+
description: Priority field with nullable enum (null already in enum)
69+
enum:
70+
- high
71+
- medium
72+
- low
73+
- null
74+
nullable: true
75+
category:
76+
type: string
77+
description: Non-nullable enum
78+
enum:
79+
- public
80+
- private
81+
- internal
82+
StatusRequest:
83+
type: object
84+
required:
85+
- status
86+
properties:
87+
status:
88+
type: string
89+
enum:
90+
- active
91+
- inactive
92+
- pending
93+
- archived
94+
nullable: true
95+
priority:
96+
type: string
97+
enum:
98+
- high
99+
- medium
100+
- low
101+
- null
102+
nullable: true
103+
Item:
104+
type: object
105+
required:
106+
- id
107+
- name
108+
properties:
109+
id:
110+
type: integer
111+
format: int64
112+
name:
113+
type: string
114+
status:
115+
type: string
116+
description: Nested nullable enum
117+
enum:
118+
- available
119+
- sold
120+
- reserved
121+
nullable: true
122+
metadata:
123+
type: object
124+
properties:
125+
visibility:
126+
type: string
127+
description: Deeply nested nullable enum
128+
enum:
129+
- visible
130+
- hidden
131+
nullable: true

0 commit comments

Comments
 (0)