Skip to content

Commit

Permalink
🐛 remove duplicate field name in body (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Feb 6, 2023
1 parent 2285d01 commit 84d223a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
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

0 comments on commit 84d223a

Please sign in to comment.