Mandatory parameters in optional properties


#1

I have a RAML that uses a resource type “collection” with optional POST and GET, so I can use it for collections, read-only collections and post-only collections:

  - collection:
      get?:
        description: Get a list of <<resourcePathName>>.
        responses:
          200:
            body:
              application/hal+json:
                example: <<exampleCollection>>
      post?:
        body:
          application/hal+json:
            example: <<exampleItemNew>>
        responses:
          201:

This resource type requires two parameters: exampleCollection, for the result of the get, and exampleItemNew for the body for the post. The problem is that I have to define both in my endpoint even if it doesn’t include the optional verb:

/operations:
  description: This resource collection represents the operations
  type:
    collection:
      exampleCollection: !include samples/operation-list.json 
      exampleItemNew:
  get:

If I remove the exampleItemNew line, I’ll get an error. Is there any way to avoid this?


#2

Hi,

I’m having exactly the same issue.
Have you found any solution or comments about it?

Thanks!