The snakeyaml library throws the following exception when the number of aliases exceeds the value from maxAliasesForCollections property of the org.yaml.snakeyaml.LoaderOptions.
org.yaml.snakeyaml.error.YAMLException: Number of aliases for non-scalar nodes exceeds the specified max=50
at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:190)
The maxAliasesForCollections value can be changed by providing custom LoaderOptions instance when creating org.yaml.snakeyaml.Yaml instance using the following constructor:
public Yaml(LoaderOptions loadingConfig) {
this(new Constructor(loadingConfig), new Representer(new DumperOptions()), new DumperOptions(),
loadingConfig);
}
but the swagger-parser doesn't provide a way to use custom LoaderOptions instance when reading yaml
public static JsonNode readYamlTree(String contents) {
org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml();
return Json.mapper().convertValue(yaml.load(contents), JsonNode.class);
}
The snakeyaml library throws the following exception when the number of aliases exceeds the value from
maxAliasesForCollections
property of theorg.yaml.snakeyaml.LoaderOptions
.The
maxAliasesForCollections
value can be changed by providing customLoaderOptions
instance when creatingorg.yaml.snakeyaml.Yaml
instance using the following constructor:but the swagger-parser doesn't provide a way to use custom
LoaderOptions
instance when reading yaml