coub / raml_ruby

Raml Ruby
MIT License
93 stars 27 forks source link

Should support null body #13

Closed bikegriffith closed 8 years ago

bikegriffith commented 9 years ago

Using this simple document:

#%RAML 0.8
title: example
baseUri: http://example.com
/name:
  get:
    responses:
      200:
        body:
          text/plain: !!null

... it raises an error body property must be a map with map values: {"text/plain"=>"text/plain"}

The RAML 0.8 spec allows this https://github.com/raml-org/raml-spec/blob/master/raml-0.8.md#body

xhh commented 9 years ago

I have a similar issue. With the following spec:

#%RAML 0.8
title: example
baseUri: http://example.com
/name:
  get:
    responses:
      200:

I got this error: Raml::InvalidProperty: responses property must be a map with map values: {200=>200}. One thing is that {200 => nil} becomes {200 => 200}, after the expand_includes method is called, just like {"text/plain"=>"text/plain"} in the description of this issue. Is it expected? Also, {200 => nil} is valid for response when validating with raml-cop, but the hash validation does not allow nil.