如何在定义中引用自我?

时间:2016-03-11 16:27:28

标签: swagger

---
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

这是最小的例子。如果我在swagger-editor中写这个,它表明parent_thing的类型为undefinedhttps://i.imgur.com/OGHlKxg.png

我该如何解决?我希望Thing能够引用其他Thing

2 个答案:

答案 0 :(得分:5)

您可以自我引用,但您可能不会使用dice-roll() { local THRESHOLD=50 #local DICE_ROLL=$[${RANDOM}%100] local DICE_ROLL=40 if ((DICE_ROLL -ge THESHOLD)); then echo "win: threshold is $THRESHOLD , rolled $DICE_ROLL" else echo "loss: rolled $DICE_ROLL" fi } 构造:

allOf

以上是有效的,如果swagger-editor没有正确显示,那就是一个bug。

答案 1 :(得分:0)

您可以通过代理模型(https://adnansabanovic.com/how-to-use-laravel-with-socket-io/)实现这一目标:

f = functions(objectiveFunction)
job.AttachedFiles = {f.file}