如何解决Swaggerhub 返回预定义的响应,但服务器存根不返回
我有 API yaml 规范,它定义了每个端点的响应应该是什么,例如我希望 /version
按照定义返回 version1.0
:
openapi: "3.0.3"
info:
title: "TITLE"
description: "DESCRIPTION"
version: "1.0.0"
paths:
/version:
get:
description: "description"
responses:
"200":
description: "description"
content:
application/json:
schema:
$ref: '#/components/schemas/version'
components:
schemas:
version:
type: object
properties:
version:
type: string
example:
"version": "version1.0"
在 Swaggerhub 上运行的 API 服务器按预期工作,但例如由 Swaggerhub 生成并在我的机器上本地运行的 python-flask 服务器存根为每个端点返回 do some magic!
,而不是 yaml 中提供的 example
。与使用 swagger-codegen 和 openapi-generator 生成的服务器存根相同。
我的主要兴趣在于让它适用于 openapi-generator 生成的服务器存根。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。