raml-org / raml-tck

Test Compatibility Kit for RAML 1.0
http://raml-org.github.io/raml-tck/
8 stars 10 forks source link

repeat is false for array types #33

Closed xaka closed 7 years ago

xaka commented 8 years ago

RAML 1.0:

types:
  Person:
    properties:
      addresses: string[]

JSON:

          "addresses": {
            "displayName": "addresses",
            "name": "addresses",
            "type": [
              "string[]"
            ],
            "repeat": false,
            "required": true
          }

I was expecting repeat to be true for array types.

KonstantinSviridov commented 8 years ago

Actually, TypeDeclaration was given the repeat property for sake of compatibility with RAML 0.8 parameters, because headers and queryParameters are arrays of TypeDeclaration. It's an alternative way to specify array type, but it does not override (or is overriden by) specifying array type directly. I mean,

MyType: string[]

and

MyType:
  type: string[]
  repeat: true

are not the same types. The last type is actually an array of string arrays. Thus, it will be incorrect to return true as default repeat value for all array types.

xaka commented 8 years ago

That's what I was afraid of - confusion between arrays in type system and repeat flag. We better to provide clarification over it in RAML spec. What do you think, @sichvoge?

KonstantinSviridov commented 8 years ago

The current spec does not say anything about the repeat property. I think, a few words similar to those I've written above would be fine. Also think, we should restrict using the property to those cases, where TypeDeclarations are used as parameters or headers.

KonstantinSviridov commented 8 years ago

In future we can have a separate set of types for parameters, like we have for annotations now. But we have to deal with multiple inheritence, when creating such types set. So this task can not be implemented immediately.

sichvoge commented 7 years ago

repeat is actually not part of the RAML 1.0 spec anymore and has been removed.