【发布时间】:2019-12-16 04:35:51
【问题描述】:
demo.yaml
content:
application/json:
schema:
title: YamlTitle
type: object
properties:
name:
"$ref": "definitions.yaml#/name"
required:
- data
definitions.yaml 文件数据
name:
type: string
minLength: 10
example: GANESH
我想读取 yaml 文件及其参考数据。
输出 结果 = {'content': {'application/json': {'schema': {'title': 'YamlTitle', 'type': 'object', 'properties': {'name': {'type': 'string', 'minLength': 10, 'example': 'GANESH'}}, 'required': ['name']}}}}
【问题讨论】:
-
查看OpenAPI Python parsers。他们可能会自动解析 $refs。
-
它没有按预期工作。
-
你能澄清一下究竟是什么按预期工作吗?你试过什么代码,得到了什么结果?
-
其实我想要结果,因为输出结果用 swagger API v3 显示在上面。所以在 v3 [OpenAPI Python 解析器].(stackoverflow.com/questions/57097285/…) 中不起作用。
-
感谢 Helen prance 库工作正常。