---
swagger: '2.0'
info:
version: 0.0.0
title: Simple API
paths:
/:
get:
responses:
200:
description: OK
definitions:
Thing:
properties:
parent_thing:
allOf:
- $ref: '#/definitions/Thing'
description: parent of this thing
Run Code Online (Sandbox Code Playgroud)
这是最小的例子.如果我在swagger-editor中编写它,则表明parent_thing的类型为undefined:https://i.imgur.com/OGHlKxg.png
我该如何解决这个问题?我想Thing引用其他Things.
您可以拥有自引用,但您可能不使用该allOf构造:
definitions:
Thing:
properties:
parent_thing:
$ref: '#/definitions/Thing'
Run Code Online (Sandbox Code Playgroud)
以上是有效的,如果swagger-editor没有正确显示,那就是一个bug.
| 归档时间: |
|
| 查看次数: |
2104 次 |
| 最近记录: |