Skip to content

Commit b7dd91c

Browse files
committed
Implement error status
1 parent dc2337a commit b7dd91c

2 files changed

Lines changed: 161 additions & 3 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/axum-example/tests/snapshots/integration_test__openapi.snap

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,134 @@ expression: openapi
8585
}
8686
}
8787
},
88+
"/error": {
89+
"get": {
90+
"operationId": "error_endpoint",
91+
"responses": {
92+
"200": {
93+
"description": "Successful response",
94+
"content": {
95+
"application/json": {
96+
"schema": {
97+
"type": "string"
98+
}
99+
}
100+
}
101+
},
102+
"400": {
103+
"description": "Error response",
104+
"content": {
105+
"application/json": {
106+
"schema": {
107+
"$ref": "#/components/schemas/ErrorResponse"
108+
}
109+
}
110+
}
111+
}
112+
}
113+
}
114+
},
115+
"/error/error-with-status": {
116+
"get": {
117+
"operationId": "error_endpoint_with_status_code",
118+
"responses": {
119+
"200": {
120+
"description": "Successful response",
121+
"content": {
122+
"application/json": {
123+
"schema": {
124+
"type": "string"
125+
}
126+
}
127+
}
128+
},
129+
"400": {
130+
"description": "Error response",
131+
"content": {
132+
"application/json": {
133+
"schema": {
134+
"$ref": "#/components/schemas/ErrorResponse"
135+
}
136+
}
137+
}
138+
}
139+
}
140+
}
141+
},
142+
"/error/error-with-status2": {
143+
"get": {
144+
"operationId": "error_endpoint_with_status_code2",
145+
"responses": {
146+
"200": {
147+
"description": "Successful response",
148+
"content": {
149+
"application/json": {
150+
"schema": {
151+
"type": "string"
152+
}
153+
}
154+
}
155+
},
156+
"400": {
157+
"description": "Error response",
158+
"content": {
159+
"application/json": {
160+
"schema": {
161+
"$ref": "#/components/schemas/ErrorResponse2"
162+
}
163+
}
164+
}
165+
},
166+
"404": {
167+
"description": "Error response",
168+
"content": {
169+
"application/json": {
170+
"schema": {
171+
"$ref": "#/components/schemas/ErrorResponse2"
172+
}
173+
}
174+
}
175+
},
176+
"500": {
177+
"description": "Error response",
178+
"content": {
179+
"application/json": {
180+
"schema": {
181+
"$ref": "#/components/schemas/ErrorResponse2"
182+
}
183+
}
184+
}
185+
}
186+
}
187+
}
188+
},
189+
"/error/error2": {
190+
"get": {
191+
"operationId": "error_endpoint2",
192+
"responses": {
193+
"200": {
194+
"description": "Successful response",
195+
"content": {
196+
"application/json": {
197+
"schema": {
198+
"type": "string"
199+
}
200+
}
201+
}
202+
},
203+
"400": {
204+
"description": "Error response",
205+
"content": {
206+
"application/json": {
207+
"schema": {
208+
"$ref": "#/components/schemas/ErrorResponse2"
209+
}
210+
}
211+
}
212+
}
213+
}
214+
}
215+
},
88216
"/health": {
89217
"get": {
90218
"operationId": "health",
@@ -452,6 +580,36 @@ expression: openapi
452580
"nestedStructMapArray"
453581
]
454582
},
583+
"ErrorResponse": {
584+
"type": "object",
585+
"properties": {
586+
"code": {
587+
"type": "integer"
588+
},
589+
"error": {
590+
"type": "string"
591+
}
592+
},
593+
"required": [
594+
"error",
595+
"code"
596+
]
597+
},
598+
"ErrorResponse2": {
599+
"type": "object",
600+
"properties": {
601+
"code": {
602+
"type": "integer"
603+
},
604+
"error": {
605+
"type": "string"
606+
}
607+
},
608+
"required": [
609+
"error",
610+
"code"
611+
]
612+
},
455613
"StructBody": {
456614
"type": "object",
457615
"properties": {

0 commit comments

Comments
 (0)