如何在 SwaggerHub 中的不同 API 之间进行引用?

Tag*_*oga 3 swagger openapi swaggerhub

我正在使用 SwaggerHub 和 OpenAPI 3.0.0。我在 SwaggerHub 中有两个 API。

第一个有以下访问链接:https : //app.swaggerhub.com/apis/myapipath/1.0.0并包含一个名为components/schemas/ApiOffer.

在第二个 API 中,我希望该属性offer成为$ref该定义的一个。我用:

components:
  schemas:
    Offerers:
      type: object
      required:
        - offererId
        - overview
      properties:
        offererId:
          $ref: '#/components/schemas/OfferersId'
        overview:
          $ref: '#/components/schemas/OfferersOverview'
        offer:
          $ref: 'https://app.swaggerhub.com/apis/myapipath/1.0.0#/components/schemas/ApiOffer'
Run Code Online (Sandbox Code Playgroud)

但得到以下错误:

“无法解析引用,因为:无法解析指针:文档中不存在 /components/schemas/ApiOffer”

即使/components/schemas/ApiOffer定义存在。

如何更正我的引用以使其指向其他 API?

Hel*_*len 5

对 SwaggerHub 定义的引用必须使用主机名API.swaggerhub.com而不是APP.swaggerhub.com.