File tree Expand file tree Collapse file tree 2 files changed +33
-0
lines changed
modules/openapi-generator/src/main/resources/python
samples/openapi3/client/petstore/python/petstore_api Expand file tree Collapse file tree 2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,13 @@ class ApiException(OpenApiException):
140140 if http_resp.status == 404:
141141 raise NotFoundException(http_resp=http_resp, body=body, data=data)
142142
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+
143150 if 500 <= http_resp.status <= 599:
144151 raise ServiceException(http_resp=http_resp, body=body, data=data)
145152 raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -178,6 +185,16 @@ class ServiceException(ApiException):
178185 pass
179186
180187
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+
181198def render_path(path_to_item):
182199 """Returns a string representation of a path"""
183200 result = ""
Original file line number Diff line number Diff line change @@ -150,6 +150,14 @@ def from_response(
150150 if http_resp .status == 404 :
151151 raise NotFoundException (http_resp = http_resp , body = body , data = data )
152152
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+
153161 if 500 <= http_resp .status <= 599 :
154162 raise ServiceException (http_resp = http_resp , body = body , data = data )
155163 raise ApiException (http_resp = http_resp , body = body , data = data )
@@ -183,6 +191,14 @@ class UnauthorizedException(ApiException):
183191class ForbiddenException (ApiException ):
184192 pass
185193
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
186202
187203class ServiceException (ApiException ):
188204 pass
You can’t perform that action at this time.
0 commit comments