raml-org / raml-js-parser

(deprecated) A RAML parser based on PyYAML written in CoffeScript and available for use as NodeJs module or in-browser.
195 stars 53 forks source link

Javascript raml parser does not report the error when inherits the definition of the resource types #111

Closed fedebongio closed 9 years ago

fedebongio commented 10 years ago

Here is a micro RAML prepared to show the problem:

#%RAML 0.8
title: uri params bug
resourceTypes:
  - base:
      uriParameters:
        mediaTypeExtension: 
          required: true

# OK
/working{mediaTypeExtension}:
  type: base

# bug: should report error "mediaTypeExtension uri parameter unused"
/inherited:
  type: base

# OK, reports error "mediaTypeExtension uri parameter unused"
/explicit:
  uriParameters:
    mediaTypeExtension: 
      required: true
dmartinezg commented 10 years ago

True, I'd say this is by design, more than a bug.

Validating RAMLs is a pretty costly operation, and we only validate before transforming the RAML with resource types, traits, default media types, etc.

to detect these errors, we would have to validate the RAML twice, which would mean a parsing time increase of 10% to 20% (in our past tests). Which for inline use in the api-designer it is quite significant.

usarid commented 9 years ago

The parser isn't validating fully, period. The fact that it isn't fully validating because it would be expensive to validate is perhaps a justified current design limitation, but it's still not doing what it needs to do, and what a user would have expected it to do. I'd like to keep this open until we can provide a better solution: perhaps offer more robust validation, if necessary through a second pass, when the UX allows it (say during idle cycles).

On Wed, Dec 3, 2014 at 12:14 PM, Damian Martinez Gelabert < notifications@github.com> wrote:

Closed #111 https://github.com/raml-org/raml-js-parser/issues/111.

— Reply to this email directly or view it on GitHub https://github.com/raml-org/raml-js-parser/issues/111#event-202191307.