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

0 stars 0 forks source link

Simplify and add example for the behaviour when resource types and traits are getting merged #12

Closed VasiliyLysokobylko closed 8 years ago

VasiliyLysokobylko commented 8 years ago

Currently, RC1 defines a merging algorithm that helps people to understand how the merging of traits (and similar for resource types) works. In RC2 we should simplify that a bit more and add an example like the following:

resourceTypes:
  collection:
    get:
      description: just a test
      headers:
        APIKey:
/resource:
  type: collection
  get:
    description: override the description
    responses:
      200:
        body:
          application/json:

The only overlay between the collection resource type and the resource declaration is description which is defined in both. In this example, the final version will have the description that has been explicitly defined in the resource.

Every explicit node will win over the ones that are declared in a resource type or trait. The rest get's simple merged. The final merged result must be:

/resource:
  get:
    headers:
      APIKey:
    description: override the description
    responses:
      200:
        body:
          application/json:
VasiliyLysokobylko commented 8 years ago

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