File tree 2 files changed +33
-0
lines changed
modules/openapi-generator/src/main/resources/python
samples/openapi3/client/petstore/python/petstore_api
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,13 @@ class ApiException(OpenApiException):
140
140
if http_resp.status == 404:
141
141
raise NotFoundException(http_resp=http_resp, body=body, data=data)
142
142
143
+ # Added new conditions for 409 and 422
144
+ if http_resp.status == 409:
145
+ raise ConflictException(http_resp=http_resp, body=body, data=data)
146
+
147
+ if http_resp.status == 422:
148
+ raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
149
+
143
150
if 500 <= http_resp.status <= 599:
144
151
raise ServiceException(http_resp=http_resp, body=body, data=data)
145
152
raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -178,6 +185,16 @@ class ServiceException(ApiException):
178
185
pass
179
186
180
187
188
+ class ConflictException(ApiException):
189
+ """Exception for HTTP 409 Conflict."""
190
+ pass
191
+
192
+
193
+ class UnprocessableEntityException(ApiException):
194
+ """Exception for HTTP 422 Unprocessable Entity."""
195
+ pass
196
+
197
+
181
198
def render_path(path_to_item):
182
199
"""Returns a string representation of a path"""
183
200
result = ""
Original file line number Diff line number Diff line change @@ -150,6 +150,14 @@ def from_response(
150
150
if http_resp .status == 404 :
151
151
raise NotFoundException (http_resp = http_resp , body = body , data = data )
152
152
153
+ # Added new exception classes for 409 and 422
154
+
155
+ if http_resp .status == 409 :
156
+ raise ConflictException (http_resp = http_resp , body = body , data = data )
157
+
158
+ if http_resp .status == 422 :
159
+ raise UnprocessableEntityException (http_resp = http_resp , body = body , data = data )
160
+
153
161
if 500 <= http_resp .status <= 599 :
154
162
raise ServiceException (http_resp = http_resp , body = body , data = data )
155
163
raise ApiException (http_resp = http_resp , body = body , data = data )
@@ -183,6 +191,14 @@ class UnauthorizedException(ApiException):
183
191
class ForbiddenException (ApiException ):
184
192
pass
185
193
194
+ class ConflictException (ApiException ):
195
+ """Exception raised for HTTP 409 Conflict errors."""
196
+ pass
197
+
198
+
199
+ class UnprocessableEntityException (ApiException ):
200
+ """Exception raised for HTTP 422 Unprocessable Entity errors."""
201
+ pass
186
202
187
203
class ServiceException (ApiException ):
188
204
pass
You can’t perform that action at this time.
0 commit comments