petrochenko-pavel-a / raml-js-parser2-issues

0 stars 0 forks source link

Add more clarification around the different default types and when they apply in which context #10

Closed VasiliyLysokobylko closed 8 years ago

VasiliyLysokobylko commented 8 years ago

The current RC1 version explains the different default types in section Shortcuts and Syntactic Sugar. In RC2 we should make sure that these are described a bit more clearly w/o using examples only.

There following rules need to be applied to determine the default type:

types:
   Person:
      type: object
      properties:

can also be written

types:
   Person: 
      # default type is `object`, no need to explicitly define it
      properties:
types:
   Person:
      properties:
         name: # no type or schema necessary since the default type is `string`
body:
  application/json: # key
    # default type is `any` 

The last rule is important for validation purposes and needs to be defined in the specification. Of course, each rule can be overridden by explicitly define a type. For example:

types:
   Person:
      properties:
         name: 
            type: number
VasiliyLysokobylko commented 8 years ago

https://github.com/raml-org/raml-spec/issues/325

petrochenko-pavel-a commented 8 years ago

This is already implemented