raml-java-parser icon indicating copy to clipboard operation
raml-java-parser copied to clipboard

Parser fails if settings are present for custom security scheme

Open osennatl opened this issue 9 years ago • 1 comments

When presented with a RAML file that contains a custom (x-{other} type) security scheme with settings, the library is failing with the following exception:

java.lang.RuntimeException: Builder not found for <NodeTuple keyNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=setting1)>; valueNode=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value=value)>>
    at org.raml.parser.builder.DefaultTupleBuilder.getBuilderForTuple(DefaultTupleBuilder.java:68)
    at org.raml.parser.visitor.YamlDocumentBuilder.onTupleStart(YamlDocumentBuilder.java:272)
    at org.raml.parser.visitor.NodeVisitor.doVisitMappingNode(NodeVisitor.java:145)
    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.doVisitMappingNode(NodeVisitor.java:151)
    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.doVisitMappingNode(NodeVisitor.java:151)
    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:102)
    at org.raml.parser.visitor.YamlDocumentBuilder.build(YamlDocumentBuilder.java:78)
...

The following RAML snippet can be used to reproduce the problem:

securedBy: [jwt]
securitySchemes:
    - jwt:
        type: x-jwt
        settings:
           setting1: value

We are using version 0.8.12.

Aha! Link: https://mulesoft-roadmap.aha.io/features/APIRAML-141

osennatl avatar Oct 02 '15 00:10 osennatl

The latest parser, 1.0.17, still has problems with settings.

I try

securitySchemes:
  x-jwt:
    type: x-jwt
    settings:
      scope: string

and the parser complains with

Unexpected key 'settings'. Options are : "describedBy" or "description" or "displayName" or "type" or /\((.+)\)/

This looks like it should be valid RAML according to the spec...

KevinMitchell avatar Feb 12 '18 16:02 KevinMitchell