Skip to content

Commit 65edf7d

Browse files
committed
update samples
1 parent 89b6a96 commit 65edf7d

File tree

4 files changed

+60
-8
lines changed

4 files changed

+60
-8
lines changed

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/exceptions.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ def from_response(
151151
if http_resp.status == 404:
152152
raise NotFoundException(http_resp=http_resp, body=body, data=data)
153153

154+
# Added new conditions for 409 and 422
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+
154161
if 500 <= http_resp.status <= 599:
155162
raise ServiceException(http_resp=http_resp, body=body, data=data)
156163
raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -189,6 +196,16 @@ class ServiceException(ApiException):
189196
pass
190197

191198

199+
class ConflictException(ApiException):
200+
"""Exception for HTTP 409 Conflict."""
201+
pass
202+
203+
204+
class UnprocessableEntityException(ApiException):
205+
"""Exception for HTTP 422 Unprocessable Entity."""
206+
pass
207+
208+
192209
def render_path(path_to_item):
193210
"""Returns a string representation of a path"""
194211
result = ""

samples/client/echo_api/python/openapi_client/exceptions.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ def from_response(
151151
if http_resp.status == 404:
152152
raise NotFoundException(http_resp=http_resp, body=body, data=data)
153153

154+
# Added new conditions for 409 and 422
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+
154161
if 500 <= http_resp.status <= 599:
155162
raise ServiceException(http_resp=http_resp, body=body, data=data)
156163
raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -189,6 +196,16 @@ class ServiceException(ApiException):
189196
pass
190197

191198

199+
class ConflictException(ApiException):
200+
"""Exception for HTTP 409 Conflict."""
201+
pass
202+
203+
204+
class UnprocessableEntityException(ApiException):
205+
"""Exception for HTTP 422 Unprocessable Entity."""
206+
pass
207+
208+
192209
def render_path(path_to_item):
193210
"""Returns a string representation of a path"""
194211
result = ""

samples/openapi3/client/petstore/python-aiohttp/petstore_api/exceptions.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,13 @@ def from_response(
150150
if http_resp.status == 404:
151151
raise NotFoundException(http_resp=http_resp, body=body, data=data)
152152

153+
# Added new conditions for 409 and 422
154+
if http_resp.status == 409:
155+
raise ConflictException(http_resp=http_resp, body=body, data=data)
156+
157+
if http_resp.status == 422:
158+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
159+
153160
if 500 <= http_resp.status <= 599:
154161
raise ServiceException(http_resp=http_resp, body=body, data=data)
155162
raise ApiException(http_resp=http_resp, body=body, data=data)
@@ -188,6 +195,16 @@ class ServiceException(ApiException):
188195
pass
189196

190197

198+
class ConflictException(ApiException):
199+
"""Exception for HTTP 409 Conflict."""
200+
pass
201+
202+
203+
class UnprocessableEntityException(ApiException):
204+
"""Exception for HTTP 422 Unprocessable Entity."""
205+
pass
206+
207+
191208
def render_path(path_to_item):
192209
"""Returns a string representation of a path"""
193210
result = ""

samples/openapi3/client/petstore/python/petstore_api/exceptions.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,11 @@ 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-
153+
# Added new conditions for 409 and 422
155154
if http_resp.status == 409:
156155
raise ConflictException(http_resp=http_resp, body=body, data=data)
157156

158-
if http_resp.status == 422:
157+
if http_resp.status == 422:
159158
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
160159

161160
if 500 <= http_resp.status <= 599:
@@ -191,16 +190,18 @@ class UnauthorizedException(ApiException):
191190
class ForbiddenException(ApiException):
192191
pass
193192

194-
class ConflictException(ApiException):
195-
"""Exception raised for HTTP 409 Conflict errors."""
193+
194+
class ServiceException(ApiException):
196195
pass
197196

198197

199-
class UnprocessableEntityException(ApiException):
200-
"""Exception raised for HTTP 422 Unprocessable Entity errors."""
198+
class ConflictException(ApiException):
199+
"""Exception for HTTP 409 Conflict."""
201200
pass
202201

203-
class ServiceException(ApiException):
202+
203+
class UnprocessableEntityException(ApiException):
204+
"""Exception for HTTP 422 Unprocessable Entity."""
204205
pass
205206

206207

0 commit comments

Comments
 (0)