I am trying to understand how to nest ref inside a ref..
I have 2 objects, ResponseObject and LastUpdatedAt:
ResponseObject:
type: object
properties:
code:
type: integer
format: int32s
minimum: 100
maximum: 600
message:
type: string
data:
type: object
required:
- code
- message
and
LastUpdatedAt:
type: object
properties:
last_updated_at:
type: long
readOnly: true
example: 1574933675150
What I want to achieve is making my example look like this:
I keep trying without success, this is as far as I've gotten:
LastUpdatedAtResponse:
schema:
$ref: "#/components/schemas/ResponseObject"
example:
- code: 200
message: 'Success'
data:
schema:
$ref: "#/components/schemas/LocalDataLastUpdatedAt"
example:
- lastUpdated: 1574933675150
but this ends up looking like this:
My end goal is to have all my objects use the ResponseObject but I can't seem to make it work. Any idea what I'm missing?
The
example
keyword does not support$ref
. You need to specify the whole example value inline:Note that
$ref
is supported in multipleexamples
, but it can only be used to reference the entire Example Object, it's impossible to$ref
just a part of an example.