From 4c6584306b40de9b2dfa9065c3a438cd918534af Mon Sep 17 00:00:00 2001 From: Man Yue Mo Date: Fri, 14 Jul 2017 17:19:53 +0100 Subject: [PATCH] parser change. --- .../java/io/swagger/parser/util/DeserializationUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/swagger-parser/src/main/java/io/swagger/parser/util/DeserializationUtils.java b/modules/swagger-parser/src/main/java/io/swagger/parser/util/DeserializationUtils.java index acd7cbacf1..c1dc478bb7 100644 --- a/modules/swagger-parser/src/main/java/io/swagger/parser/util/DeserializationUtils.java +++ b/modules/swagger-parser/src/main/java/io/swagger/parser/util/DeserializationUtils.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.databind.JsonNode; import io.swagger.util.Json; import io.swagger.util.Yaml; +import org.yaml.snakeyaml.constructor.SafeConstructor; import java.io.IOException; @@ -57,12 +58,12 @@ private static boolean isJson(String contents) { } public static JsonNode readYamlTree(String contents) { - org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml(); + org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml(new SafeConstructor()); return Json.mapper().convertValue(yaml.load(contents), JsonNode.class); } public static T readYamlValue(String contents, Class expectedType) { - org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml(); + org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml(new SafeConstructor()); return Json.mapper().convertValue(yaml.load(contents), expectedType); } }