From 9c2d30db9e8457f418c7f291af5696cb0be471bb Mon Sep 17 00:00:00 2001 From: Roberto Polli Date: Mon, 27 Jul 2020 16:21:19 +0200 Subject: [PATCH] Yaml is a superset of json. --- fastapi_code_generator/parser.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/fastapi_code_generator/parser.py b/fastapi_code_generator/parser.py index 5208fa8..5a9ef59 100644 --- a/fastapi_code_generator/parser.py +++ b/fastapi_code_generator/parser.py @@ -6,11 +6,8 @@ from typing import Any, Dict, List, Optional, Union import stringcase -from datamodel_code_generator import ( - DataModelField, - load_json_or_yaml, - snooper_to_methods, -) +import yaml +from datamodel_code_generator import DataModelField, snooper_to_methods from datamodel_code_generator.imports import IMPORT_LIST, Import, Imports from datamodel_code_generator.model.pydantic.types import type_map from datamodel_code_generator.parser.jsonschema import ( @@ -390,7 +387,7 @@ def __init__( model_path_var.set(model_path) def parse(self) -> ParsedObject: - openapi = load_json_or_yaml(self.input_text) + openapi = yaml.safe_load(self.input_text) return self.parse_paths(openapi) def parse_security(