0

我收到Data does not match any schemas from 'oneOf'以下规格的错误:

product: 1.0.0
info:
  name: account-information
  title: Account Information
  version: 1.0.10
  termsOfService: >-
    These API are a PSD2 implementation example. The service might be
    discontinued at any time
visibility:
  view:
    type: public
  subscribe:
    type: authenticated
plans:
  premium:
    title: Premium
    apis: {}
    rate-limit:
      value: 1000/1minute
      hard-limit: true
    approval: true
  default:
    title: Default Plan
    description: Default Plan
    approval: false
    rate-limit:
      value: 100/hour
      hard-limit: true
apis:
  account:
    $ref: account.yaml
  subscription:
    $ref: subscription.yaml

完整的错误信息:

消息:“数据不匹配来自“oneOf”的任何模式”,Chemin de données:“”,Chemin de schéma:“/oneOf”

消息:“不允许附加属性”,Chemin de données:“/name”,Chemin de schéma:“/oneOf/0/additionalProperties”

我不明白错误来自哪里以及如何解决它。

4

1 回答 1

1

对于 API Connect,我相信您想使用x-ibm-name而不是name。我能够使用您上面的示例验证以下规范:

info:
  title: Account Information
  x-ibm-name: account-information
  version: 1.0.10
visibility:
  view:
    type: public
  subscribe:
    type: authenticated
plans:
  premium:
    title: Premium
    apis: {}
    rate-limit:
      value: 1000/1minute
      hard-limit: true
    approval: true
  default:
    title: Default Plan
    description: Default Plan
    approval: false
    rate-limit:
      value: 100/hour
      hard-limit: true
apis:
  account:
    $ref: account.yaml
  subscription:
    $ref: subscription.yaml

注意:我还删除了产品字段。

您还可以使用“设计”选项卡让 API Connect 以正确的格式自动创建源:

在此处输入图像描述

于 2017-02-28T15:53:30.313 回答