-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[python-nextgen] Add ApiResponse object (#15367)
* add ApiResponse object * fix tests * improve api response * add back _preload_content, add tests
- Loading branch information
Showing
38 changed files
with
1,343 additions
and
1,317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
modules/openapi-generator/src/main/resources/python-nextgen/api_response.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""API response object.""" | ||
|
||
from __future__ import annotations | ||
from typing import Any, Dict, Optional | ||
from pydantic import Field, StrictInt, StrictStr | ||
|
||
class ApiResponse: | ||
""" | ||
API response object | ||
""" | ||
|
||
status_code: Optional[StrictInt] = Field(None, description="HTTP status code") | ||
headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") | ||
data: Optional[Any] = Field(None, description="Deserialized data given the data type") | ||
raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") | ||
|
||
def __init__(self, | ||
status_code=None, | ||
headers=None, | ||
data=None, | ||
raw_data=None): | ||
self.status_code = status_code | ||
self.headers = headers | ||
self.data = data | ||
self.raw_data = raw_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.