OpenAPI で $ref で参照した schema に nullable:true を追加する
code:api.yml
schema:
Hoge:
type: string
enum:
- foo
- bar
であるとき、場合によっては nullable: true としたい
code: api.yml
paths:
/api:
post:
requestBody:
content:
application/json:
schema:
type: object
properties:
hoge:
nullable: true
allOf:
- $ref: "#components/schema/Hoge"
のように allOf を使うとマージできる