eigengo / sbt-raml-plugin

RAML compiler and documentation generator
15 stars 4 forks source link

raml:verify fails to resolve local resource includes #10

Open sslavic opened 9 years ago

sslavic commented 9 years ago

source in Raml is pointing to directory where my raml file is located. Raml file is referencing with !include json schema files, located in same directory as raml file. raml:verify fails with:

[info] Compiling 1 RAML files
java.lang.RuntimeException: resource not found: foo-bar.json
    at org.raml.parser.visitor.YamlDocumentBuilder.onCustomTagError(YamlDocumentBuilder.java:307)
    at org.raml.parser.tagresolver.IncludeResolver.resolve(IncludeResolver.java:71)
    at org.raml.parser.visitor.NodeVisitor.resolveTag(NodeVisitor.java:162)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:139)
    at org.raml.parser.visitor.NodeVisitor.visitMappingNode(NodeVisitor.java:86)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:218)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.visitSequence(NodeVisitor.java:247)
    at org.raml.parser.visitor.NodeVisitor.visit(NodeVisitor.java:226)
    at org.raml.parser.visitor.NodeVisitor.visitResolvedNode(NodeVisitor.java:180)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:151)
    at org.raml.parser.visitor.NodeVisitor.visitDocument(NodeVisitor.java:209)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:90)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:107)
    at org.eigengo.sbtraml.RamlVerify.verify(RamlVerify.scala:17)
    at org.eigengo.sbtraml.RamlVerify$$anonfun$run$2.apply(RamlVerify.scala:25)
    at org.eigengo.sbtraml.RamlVerify$$anonfun$run$2.apply(RamlVerify.scala:25)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
    at org.eigengo.sbtraml.RamlVerify.run(RamlVerify.scala:25)
    at org.eigengo.sbtraml.RamlSettings$Keys$$anonfun$baseRamlSettings$1.apply(RamlPlugin.scala:59)
    at org.eigengo.sbtraml.RamlSettings$Keys$$anonfun$baseRamlSettings$1.apply(RamlPlugin.scala:59)

Maybe it's outdated raml-java-parser dependency (where a bug like https://github.com/raml-org/raml-java-parser/issues/37 was solved in newer release), bug in usage of raml-java-parser APIs, or non-resolved raml-java-parser bug.

ghost commented 9 years ago

Experiencing the same thing. !include doesn't work and throws a resource not found exception.

alexarthur commented 9 years ago

I've found that RAML with included JSON examples containing "!include " syntax, pass validation and parses just fine. However, when referencing the example from the resulting Raml object, the value of the example becomes "\n" rather than the file content. I'm using 0.9-SNAPSHOT, dated 2015-Feb-18