如何在RAML资源类型中合并多个示例?

时间:2019-04-30 03:49:35

标签: mule raml

我有这样的资源类型(不必要的部分被截断了):

#%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,则不应抛出错误! 通过“联盟”,我想到的是“要么是要么不是”。

0 个答案:

没有答案