Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Should missing parameter value throw a parsing exception? #106

Open
monikma opened this issue May 30, 2014 · 1 comment
Open

Should missing parameter value throw a parsing exception? #106

monikma opened this issue May 30, 2014 · 1 comment

Comments

@monikma
Copy link

monikma commented May 30, 2014

According to http://raml.org/spec.html#toc_59 and my understanding, if we specify a parameter inside a trait/resource type, and then try to use this type without providing the parameter value, the parsing should fail:

"The definitions of resource types and traits MAY contain parameters, whose values MUST be specified when applying the resource type or trait, UNLESS the parameter corresponds to a reserved parameter name, in which case its value is provided by the processing application (whatever is consuming the API definition)."

In our resource type we have a parameter called <<commonResourceSchema>> and if we use this resource type in our RAML without specifying the commonResourceSchema parameter, the parsing still passes. Shouldn't it fail, according to the specs?

We have the problem that such RAML is not correctly picked up by other tool, because of "syntax error". We can implement an additional validation ourselves, but I'm just wondering that maybe it should be part of the RAML parser.

Monika

@dmartinezg
Copy link

Hi @monami555, for performance reasons, trait and resource types are validated only when they are actually mixed in with the method/resource.

The only scenario in which I would see a missing parameter not get validated is in a trait that is applied at a resource level in a methodless resource:

#%RAML 0.8
title: My API
traits:
  - traitName:
      description: <<description>>
/resource:
  is: [traitName]

We will re-consider parsing and validating parameters for applied traits on these scenarios, and update the parser accordingly.

If you have found a different scenario in which parameters are not validated, please post the RAML spec on this issue and I'll take a look.

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants