Skip to content

Instantly share code, notes, and snippets.

@KangoV
Created June 30, 2024 01:26
Show Gist options
  • Save KangoV/ad36a85420f7c8187a208e09fe9d4242 to your computer and use it in GitHub Desktop.
Save KangoV/ad36a85420f7c8187a208e09fe9d4242 to your computer and use it in GitHub Desktop.
OpenAPI Java Micronaut generator inheritence bug
# json-patch schema
JsonOp:
type: object
discriminator:
propertyName: op
mapping:
add: "#/components/schemas/OpAdd"
remove: "#/components/schemas/OpRemove"
replace: "#/components/schemas/OpReplace"
move: "#/components/schemas/OpMove"
copy: "#/components/schemas/OpCopy"
test: "#/components/schemas/OpTest"
required:
- path
- op
properties:
path:
type: string
format: relative-json-pointer
op:
type: string
oneOf:
- $ref: "#/components/schemas/OpAdd"
- $ref: "#/components/schemas/OpRemove"
- $ref: "#/components/schemas/OpReplace"
- $ref: "#/components/schemas/OpMove"
- $ref: "#/components/schemas/OpCopy"
- $ref: "#/components/schemas/OpTest"
OpAdd:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
properties:
value: { type: string }
# required: [ value ]
OpRemove:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
OpReplace:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
properties:
value: { type: string }
# required: [ value ]
OpMove:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
properties:
from: { type: string, format: relative-json-pointer }
# required: [ from ]
OpCopy:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
properties:
from: { type: string, format: relative-json-pointer }
# required: [ from ]
OpTest:
allOf:
- $ref: "#/components/schemas/JsonOp"
- type: object
properties:
value: { type: string }
# required: [ value ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment