raml-org / raml-java-parser

(deprecated) A RAML parser based on SnakeYAML written in Java
Other
174 stars 121 forks source link

Errors with insufficient information about code position. #66

Open KonstantinSviridov opened 9 years ago

KonstantinSviridov commented 9 years ago

Hi, guys.

Some places in the parser throw exceptions which do not provide information about code position. For example:

java.lang.ClassCastException: org.yaml.snakeyaml.nodes.ScalarNode cannot be cast to org.yaml.snakeyaml.nodes.MappingNode
at org.raml.parser.visitor.TemplateResolver.loopTemplateSequence(TemplateResolver.java:145)
at org.raml.parser.visitor.TemplateResolver.init(TemplateResolver.java:129)
at org.raml.parser.visitor.RamlValidationService.preValidation(RamlValidationService.java:51)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:64)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:95)
at org.raml.parser.visitor.YamlValidationService.validate(YamlValidationService.java:77)

Being able to see positions and messages describing RAML nature of the error would be nice.

Initially the problem arose with RAML->JAX-RS generator. https://github.com/mulesoft/raml-for-jax-rs/issues/103 I post this issue as the generator makes use of the 0.9-SNAPSHOT parser.

Regards, Konstantin.

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

ok11 commented 9 years ago

Hi folks,

as the original issue was open by me, feel free to ask for snippets, where the problem may be reproduced

Regards, ok11