R
R
Romi2021-10-17 10:25:00
API
Romi, 2021-10-17 10:25:00

When should you put "-" before $ref: in OpenAPI (Swagger)?

I don't grasp the system, in which cases it is necessary to write like this:

- $ref: '#/components/schemas/User'

and when like this:

$ref: '#/components/schemas/User'

Clarify the question plz, who knows :)

What does this hyphen mean in OpenAPI?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-10-17
@romicohen

Read about YAML syntax.
A hyphen at the beginning of a line means "array element"
. the first entry is the second just
[ { "$ref": "#/components/schemas/User" } ]
{ "$ref": "#/components/schemas/User" }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question