gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 19:59:16 24 4
gpt4 key购买 nike

我正在使用 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'

但出现以下错误:

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

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

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

最佳答案

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

关于swagger - 如何在 SwaggerHub 中的不同 API 之间进行引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53260146/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com