Skip to content

Changed the way parameters are named #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@

#### apiclient-pydantic-generator `0.1.1` (2021-10-24)
#### apiclient-pydantic-generator `0.1.1` (2022-03-01)

##### ♻️ Changes

- Small changes.
- Changed the way parameters are named
- The response data type is obtained from the 200 or 201 response code

##### ⬆️ Dependencies

Expand Down
8 changes: 4 additions & 4 deletions apiclient_pydantic_generator/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def get_argument_list(self, snake_case: bool, path: List[str]) -> List[Argument]
return arguments

def create_pydantic_argument(self, path: List[str], fields: List[DataModelField], suffix: str):
original_name = self._get_model_name('_'.join(field.name for field in fields), '', suffix=suffix)
original_name = self._get_model_name(path[1], '', suffix=suffix)
name = self.model_resolver.get_class_name(
name=original_name,
unique=False,
Expand Down Expand Up @@ -384,9 +384,9 @@ def parse_responses(
path: List[str],
) -> Dict[str, Dict[str, DataType]]:
data_types = super().parse_responses(name, responses, path)
status_code_200 = data_types.get('200')
if status_code_200:
data_type = list(status_code_200.values())[0]
response_status_code = data_types.get('200') or data_types.get('201')
if response_status_code:
data_type = list(response_status_code.values())[0]
if data_type:
self.data_types.append(data_type)
type_hint = data_type.type_hint # TODO: change to lazy loading
Expand Down