jdiegodcp / ramlfications

Python parser for RAML
https://ramlfications.readthedocs.org
Apache License 2.0
234 stars 50 forks source link

Support optional properties in resource types (not just methods) & traits #43

Open econchick opened 8 years ago

econchick commented 8 years ago

Currently, ramlfications only supports an optional method parameter within ResourceTypes (e.g. get?, post?, yet the RAML spec allows support for all non-scalar properties within a resource type and a trait.

For example:

# <--snip-->
resourceTypes:
  - gizmoType:
      description: get-method resource type example
      usage: Some sort of usage description
      get:
        description: This description should be inherited when applied to resources
        headers?:
          X-Inherited-Header:
            description: This header should be inherited
/a-gizmo-resource
  type: gizmoType
  get:
    description: foo
    headers:
      X-Gizmo-Header:
        description: Here is a gizmo header

Here the headers under gizmoType are denoted as optional (with the ?) but does not actually get carried down into the /a-gizmo-resource as it explicitly defines headers (shouldn't be exclusive one or the other, either).