raml-org/raml-java-parser

Type is not inferred from property `items`

jstoiko opened this issue · 0 comments

Similarly to the property properties of the "Object" type, the "Array" type should be inferred when the property items is defined (and the type is not set).

See two scenarios below:

#%RAML 1.0
title: My API
mediaType: application/json

/resource:
  post:
    body:
      items: integer
      example: [1, 2]

/other_resource:
  post:
    body:
      items:
        properties:
          Foo: integer
          Bar: string
      example:
        [{"Foo": 1, "Bar": "Qux"}]

Both validate fine in AMF:

$ java -jar amf-3.5.4.jar validate -in "RAML 1.0" -mime-in "application/yaml" -p "RAML" file:///tmp/api.raml
{
  "@type": "http://www.w3.org/ns/shacl#ValidationReport",
  "http://www.w3.org/ns/shacl#conforms": true
}