raml-org / raml-java-parser

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

resourcePathName is not being resolved correctly for type/schema #337

Closed benken-parasoft closed 6 years ago

benken-parasoft commented 7 years ago

Clone the current raml-tutorial-200: https://github.com/raml-org/raml-tutorial-200 . raml-parser-2 fails with the following three ValidationResults:

Invalid reference 'song' -- jukebox-api.raml [line=45, col=21]
Invalid reference 'artist' -- jukebox-api.raml [line=45, col=21]
Invalid reference 'album' -- jukebox-api.raml [line=45, col=21]

Line 45 of jukebox-api.raml has the following:

schema: <<resourcePathName|!singularize>>

The raml-tutorial-200 parsed successfully using the original raml-parser. However, it still does not parse with raml-parser-2, even in version 1.0.6 which included a fix for https://github.com/raml-org/raml-java-parser/issues/334 for "resourcePathName is not being resolved correctly". I am not able to migrate to raml-parser-2 until it is at least able to parse the tutorial example.

benken-parasoft commented 7 years ago

The RAML 0.8 version of Remote Vending API also used to parse in raml-parser but fails in raml-parser-2. See https://raw.githubusercontent.com/mulesoft/mulesoft-docs/f5afa20aa9d66675c9038ccafc92300bc77a08c2/apikit/v/latest/_attachments/api.raml

raml-parser-2 returns the following validation results:

Invalid reference 'post<<resourcePathName' -- remote-vending.raml [line=144, col=42]
Invalid reference '!singularize>>' -- remote-vending.raml [line=144, col=58]
Invalid reference 'get<<resourcePathName>>' -- remote-vending.raml [line=139, col=23]
Invalid reference 'get<<resourcePathName>>' -- remote-vending.raml [line=139, col=23]
benken-parasoft commented 7 years ago

I also see this issue when parsing the RAML 1.0 example "alainn-mobile-shopping" from https://github.com/raml-org/raml-examples/tree/master/others/alainn-mobile-shopping

raml-parser-2 returns the following validation results:

Invalid element {
type: typ.Post<<resourcePathName | !uppercamelcase>>Request
}. -- modules/resource-types.lib.raml [line=24, col=9]

Invalid element {
type: typ.Put<<resourcePathName | !uppercamelcase>>Request
}. -- modules/resource-types.lib.raml [line=42, col=9]

Invalid element {
type: typ.Patch<<resourcePathName | !uppercamelcase>>Request
}. -- modules/resource-types.lib.raml [line=48, col=9]
benken-parasoft commented 7 years ago

This appears to have been fixed in the 1.0.8 release.