[POSSIBLE BUG] [SUPPORT NEEDED] Builder not found for `uses`
hellboy81 opened this issue · 2 comments
Problem:
In org.raml.parser.builder.DefaultTupleBuilder::getBuilderForTuple
runtime exception Builder not found for
is thrown.
tuple = {NodeTuple@4000} "<NodeTuple keyNode= <org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=uses)>; valueNode=<org.yaml.snakeyaml.nodes.MappingNode (tag=tag:yaml.org,2002:map, values={ key=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; value=<NodeTuple keyNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; valueNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=./dataTypes/shapes.raml)>> })>>"
keyNode = {ScalarNode@4001} "<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=uses)>"
style = {DumperOptions$ScalarStyle@4070} "Scalar style: 'null'"
value = "uses"
tag = {Tag@4071} "tag:yaml.org,2002:str"
startMark = {Mark@4072} " in 'reader', line 7, column 1:\n uses:\n ^"
endMark = {Mark@4073} " in 'reader', line 7, column 5:\n uses:\n ^"
type = {Class@325} "class java.lang.Object"
twoStepsConstruction = false
resolved = true
useClassConstructor = null
valueNode = {MappingNode@4067} "<org.yaml.snakeyaml.nodes.MappingNode (tag=tag:yaml.org,2002:map, values={ key=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; value=<NodeTuple keyNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; valueNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=./dataTypes/shapes.raml)>> })>"
Cause:
uses
is not found in getBuilders
map:
"resourceTypes" -> {SequenceTupleBuilder@4095}
"traits" -> {SequenceTupleBuilder@4097}
"documentation" -> {SequenceTupleBuilder@4099}
"resources" -> {ImplicitMapEntryBuilder@4101} "null"
"mediaType" -> {ScalarTupleBuilder@4103}
"title" -> {ScalarTupleBuilder@4105}
"version" -> {ScalarTupleBuilder@4107}
"baseUriParameters" -> {MapTupleBuilder@4109} "baseUriParameters"
"baseUri" -> {ScalarTupleBuilder@4111}
"schemas" -> {GlobalSchemaSequenceTupleBuilder@4113}
"protocols" -> {ProtocolBuilder@4115}
"securitySchemes" -> {SequenceTupleBuilder@4117}
"securedBy" -> {SequenceTupleBuilder@4119}
Source raml file:
#%RAML 1.0
title: ...
version: 1.0
mediaType: application/json
uses:
shapes: ./dataTypes/shapes.raml
Stack trace:
java.lang.RuntimeException: Builder not found for <NodeTuple keyNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=uses)>; valueNode=<org.yaml.snakeyaml.nodes.MappingNode (tag=tag:yaml.org,2002:map, values={ key=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; value=<NodeTuple keyNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=shapes)>; valueNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=./dataTypes/shapes.raml)>> })>>
at org.raml.parser.builder.DefaultTupleBuilder.getBuilderForTuple(DefaultTupleBuilder.java:72)
at org.raml.parser.visitor.YamlDocumentBuilder.onTupleStart(YamlDocumentBuilder.java:281)
at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:154)
at org.raml.parser.visitor.NodeVisitor.visitDocument(NodeVisitor.java:218)
at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:95)
at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:111)
Used versions:
<dependency>
<groupId>org.raml</groupId>
<artifactId>raml-parser</artifactId>
<version>0.8.36</version>
</dependency>
<dependency>
<groupId>org.raml</groupId>
<artifactId>raml-parser-2</artifactId>
<version>1.0.45-SNAPSHOT</version>
</dependency>
@hellboy81: have you looked into webapi-parser[1]? It is the new official parser for RAML as raml-java-parser is being deprecated. It also has a builder[2].
[1] https://github.com/raml-org/webapi-parser
[2] https://raml-org.github.io/webapi-parser/constructing.html
The stacktrace comes from the 0.8 parser, which doesn't parse RAML 1.0 specs. It should work with the 1.0.45 spec which has a completely different api.
That being said, @jstoiko's comment points you in a better direction: webapi-parser is the currently supported parser: the other two are deprecated.