Как сделать объединение для нескольких примеров в типе ресурсов RAML? - PullRequest
0 голосов
/ 30 апреля 2019

У меня есть такой тип ресурса (усеченная ненужная часть):

#%RAML 1.0 ResourceType

usage: Use this resourceType when the only operation is post
description: Post <<type-name>>

post:
  description: Post <<type-name>>
  body:
    application/json:
      type: <<type-name>> 
      examples: 
        ex: <<request-example>>     
  responses:
    200:
      body:
        application/json:
          type: <<response-type-name>>
          examples: 
            ex: <<response-example>>

Я использую его так:

/notifications:
  is:
    - clientIdClientSecret
  description: Send the notification payload from apple or android notification service
  type:
    postResourceType:
      type-name: AndroidRequest | AppleRequest
      response-type-name: AndroidResponse | AppleResponse
      request-example: !include /examples/android-request.raml
      response-example: !include /examples/android-response.raml
      error-type-name: error
      errors-example: !include /examples/error.raml
  post:
    queryParameters:
        platform: 
          description: |
            "Represents the name of the platform" 
              - apple = apple platform
          enum:
            - 'apple'
          type: string
          required: true

Я смог сделать объединение для таких типов, какAndroidRequest | AppleRequest.Как мне сделать объединение для примеров?И союз должен быть необязательным!так должно быть request-example1 | request-example2.Но если я не предоставлю request-example2 в конечной точке, где или не требуется, это не должно выдавать ошибку!«Союз» означает «или-или», что я имею в виду (НЕ ОБА).

...