I am trying to get a multi-line literal in Swagger editor (awesome tool, by the way!).
post:
summary: Translate one or more identifiers
description: |
Translate one or more identifiers for one entity into the
identifiers of another entity. Translate one or more
identifiers for one entity into the identifiers of another entity.
consumes:
- application/json
I've tried it with | and >, with different endings (increasing indent vs. empty line), and every way I can think of, but it always gives the same error:
YAML Syntax Error
Can not read a block mapping entry; a multiline key may not be an implicit
key at line 24, column 15: consumes: ^
I see bugs for JS-YAML that indicate the problem is a Windows-style newline at the end, which I know HTML textareas can create. This is the first time I'm really using YAML much, so is it just me doing something wrong, or a bug in Swagger editor?
Multi-line blocks and long strings. YAML also supports writing strings on multiple lines in your YAML, with two different styles: literal and folded. Those are represented by a | (for literal style) or > (for folded style) header line (see examples below), and we will go into their differences soon.
Click on the + button on the left of each line of the Swagger spec to add your comment from the Comment Bar. The Comment Bar houses all the comments, both resolved and unresolved, on the API spec, sorted by line. You can access the Comment Bar anytime from the Swagger UI.
I believe the problem is the way you started the text on your description block. It must be indented one level to the right of description: Here's an example of something that works for me:
/{user-id}:
get:
summary: Facebook User
description: |
Displays all information about a Facebook user, depending on access privileges. Displays all information about a Facebook user, depending on access privileges.
parameters:
- name: user-id
in: path
description: The Facebook user ID
required: true
type: string
In my actual code, the description is three lines long.
It's the indentation. It should be like:
post:
summary: Translate one or more identifiers
description: |
Translate one or more identifiers for one entity into the
identifiers of another entity. Translate one or more
identifiers for one entity into the identifiers of another entity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With