swaggerの書き方によっては、スタブのレスポンスでデータが出力されないことがありました。
①$ref参照の中で、さらに$refを参照。
get:
.....
responses:
"200":
schema:
$ref: "#/definitions/sampleAList"
definitions:
sampleAList:
type: object
properties:
resultAList:
type: array
items:
type: object
properties:
aaaCd:
type: string
bbbCd:
type: string
resultBList:
$ref: "#/definitions/sampleBList"
sampleBList:
type: object
~~~
⇒この場合、resultBListが空となる。
別のところで使用していても、毎回省略せずすべて書く必要がある。
②出力されない書き方例:$ref参照のtypeがarray。
get:
.....
responses:
"200":
schema:
$ref: "#/definitions/sampleAList"
definitions:
sampleAList:
type: array
items:
properties:
aaaCd:
type: string
bbbCd:
type: string
⇒この場合、responseのbodyは空となる。
(設計書の表示としては問題ない)
sampleAListをtype: objectにするとスタブが生成される。