Skip to content

Commit 50ee795

Browse files
author
miggyst
authored
fix: Fixed parsing logic for yaml files to use PyYaml instead of ruamel.yaml BNCH-37249 (#120)
1 parent 97f3908 commit 50ee795

File tree

5 files changed

+4
-60
lines changed

5 files changed

+4
-60
lines changed

openapi_python_client/templates/endpoint_module.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ from typing import Any, Dict, List, Optional, Union, cast
22

33
import httpx
44
from attr import asdict
5-
from ruamel.yaml import YAML
5+
import yaml
66

77
from ...client import AuthenticatedClient, Client
88
from ...types import Response

openapi_python_client/templates/property_templates/model_property.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{% macro construct(property, source, initial_value=None) %}
22
{% if property.required and not property.nullable %}
33
{% if source == "response.yaml" %}
4-
yaml = YAML(typ="base")
5-
yaml_dict = yaml.load(response.text.encode('utf-8'))
4+
yaml_dict = yaml.safe_load(response.text.encode("utf-8"))
65
{{ property.python_name }} = {{ property.reference.class_name }}.from_dict(yaml_dict)
76
{% else %}
87
{{ property.python_name }} = {{ property.reference.class_name }}.from_dict({{ source }})

poetry.lock

Lines changed: 1 addition & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ attrs = ">=20.1.0, <22.0"
3434
python-dateutil = "^2.8.1"
3535
httpx = ">=0.15.4,<=0.22.0"
3636
autoflake = "^1.4"
37-
"ruamel.yaml" = "^0.17.21"
3837

3938
[tool.poetry.scripts]
4039
openapi-python-client = "openapi_python_client.cli:app"

tests/test_templates/endpoint_module.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import httpx
44
from attr import asdict
5-
from ruamel.yaml import YAML
5+
import yaml
66

77
from ...client import AuthenticatedClient, Client
88
from ...types import Response

0 commit comments

Comments
 (0)