0

I have found some internal async-api schema that looks like the following example:

  schemas:
    Example:
      type: object
      allOf:
        - $ref: '#/components/schemas/Foo'
        - type: object
          properties:
            bar:
              type: string
              description: >-
                Some description

What does the >- mean in this case? I could not find any documentation about this. The official specification only mentions the | character, which indicates a multiline string.

mamen
  • 1,202
  • 6
  • 26
  • 3
    It's not part of the AsyncAPI spec, just basic YAML - https://yaml-multiline.info/ – jonrsharpe Mar 09 '23 at 09:58
  • 1
    See also [What's the difference between |, > and >- in OpenAPI YAML descriptions?](https://stackoverflow.com/q/67377832/113116) (it applies to both OpenAPI and AsyncAPI). – Helen Mar 09 '23 at 10:07
  • 1
    It is one of the many many YAML string formatting options. See [How do I break a string in YAML over multiple lines?](https://stackoverflow.com/questions/3790454/how-do-i-break-a-string-in-yaml-over-multiple-lines) – IMSoP Mar 09 '23 at 10:10
  • Thank you for the quick responses. I was only searching for "async-api multiline strings" and "swagger multiline strings", that's why I did not find anything. But it makes sense, since it is in the yaml-specification and not swagger- or async-api specific. – mamen Mar 09 '23 at 10:17

1 Answers1

4

| and > are both used for multiline strings.

Block Style Indicator: The block style indicates how newlines inside the block should behave. If you would like them to be kept as newlines, use the literal style, indicated by a pipe (|). If instead you want them to be replaced by spaces, use the folded style, indicated by a right angle bracket (>). (To get a newline using the folded style, leave a blank line by putting two newlines in. Lines with extra indentation are also not folded.)

Block Chomping Indicator: The chomping indicator controls what should happen with newlines at the end of the string. The default, clip, puts a single newline at the end of the string. To remove all newlines, strip them by putting a minus sign (-) after the style indicator. Both clip and strip ignore how many newlines are actually at the end of the block; to keep them all put a plus sign (+) after the style indicator.

Source with interactivity, so you can easily see the differences between these syntaxes: https://yaml-multiline.info/

See also How do I break a string in YAML over multiple lines? for an in-depth explanation.

CheddarLizzard
  • 471
  • 4
  • 10