简体   繁体   中英

How do I refer between different APIs in SwaggerHub?

I am working with SwaggerHub and OpenAPI 3.0.0. I have two APIs in SwaggerHub.

The first has got following access link: https://app.swaggerhub.com/apis/myapipath/1.0.0 and contains a definition named components/schemas/ApiOffer .

In the second API, I want the property offer to be a $ref to that definition. I use:

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'

but get the following error:

"Could not resolve reference because of: Could not resolve pointer: /components/schemas/ApiOffer does not exist in document"

even though the /components/schemas/ApiOffer definition exists.

How do I correct my reference so that it points to the other API?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM