Skip to content
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

Fix: duplicate field name in path and body #17

Merged
merged 1 commit into from
Feb 6, 2023
Merged
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
4 changes: 4 additions & 0 deletions codegen/parser/endpoints/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def header_params(self) -> List[Parameter]:
def cookie_params(self) -> List[Parameter]:
return [param for param in self.parameters if param.param_in == "cookie"]

@property
def param_names(self) -> List[str]:
return [param.prop_name for param in self.parameters]

def get_imports(self) -> Set[str]:
imports = set()
for param in self.parameters:
Expand Down
6 changes: 4 additions & 2 deletions codegen/templates/client/_param.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
{% endfor %}
{% endmacro %}

{% macro body_params(model) %}
{% macro body_params(model, exclude=[]) %}
{% for prop in model.properties %}
{% if prop.prop_name not in exclude %}
{{ prop.get_param_defination() }},
{% endif %}
{% endfor %}
{% endmacro %}

Expand All @@ -44,7 +46,7 @@
{{ cookie_params(endpoint) }}
*,
data: Unset = UNSET,
{{ body_params(model) }}
{{ body_params(model, endpoint.param_names) }}
{% endmacro %}

{% macro endpoint_params(endpoint, model) %}
Expand Down
6 changes: 0 additions & 6 deletions githubkit/rest/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,6 @@ def update_org_variable(
name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
visibility: Union[Unset, Literal["all", "private", "selected"]] = UNSET,
selected_repository_ids: Union[Unset, List[int]] = UNSET,
Expand Down Expand Up @@ -2235,7 +2234,6 @@ async def async_update_org_variable(
name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
visibility: Union[Unset, Literal["all", "private", "selected"]] = UNSET,
selected_repository_ids: Union[Unset, List[int]] = UNSET,
Expand Down Expand Up @@ -5570,7 +5568,6 @@ def update_repo_variable(
name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
) -> "Response":
...
Expand Down Expand Up @@ -5618,7 +5615,6 @@ async def async_update_repo_variable(
name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
) -> "Response":
...
Expand Down Expand Up @@ -6468,7 +6464,6 @@ def update_environment_variable(
environment_name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
) -> "Response":
...
Expand Down Expand Up @@ -6522,7 +6517,6 @@ async def async_update_environment_variable(
environment_name: str,
*,
data: Unset = UNSET,
name: Union[Unset, str] = UNSET,
value: Union[Unset, str] = UNSET,
) -> "Response":
...
Expand Down