`bundle` command converts multiline strings from literal mode to folded mode
Describe the bug As the openapi documentation says: there is two modes for multiline strings in yaml:
- Literal mode - Line breaks in the source YAML file are preserved in the output
- Folded mode - Line breaks are removed so the output is a single string. Use an empty line to force a line break.
Literal mode starts with pipe symbol '|':
description: |
first line
second line
Folded mode starts with symbol '>':
description: >
first line.
also first line
second line
BUG: bundle command converts multiline strings from literal mode to folded mode in some cases.
I had done some experiments and found out that conversion to folded mode happen when any line of the multiline string have length more than (>) 80 symbols (indent spaces included).
To Reproduce Given OpenAPI file
openapi: 3.0.1
info:
title: Demo API
version: '1.0'
tags:
- name: WithShortDescription
description: |
first line is not long
second line exists
- name: WithLongDescription
description: |
first line loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
second line exists
paths: {}
Run bundle command:
openapi bundle openapi.yaml --output bundled.yaml
Open the bundled result and see:
openapi: 3.0.1
info:
title: Demo API
version: '1.0'
tags:
- name: WithShortDescription
description: |
first line is not long
second line exists
- name: WithLongDescription
description: >
first line
loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
second line exists
paths: {}
components: {}
As you can see second tag description was converted to folded mode
Expected behavior
In my opinion expected behavior is to save multiline string mode from initial file.
So the result of bundle command should be:
openapi: 3.0.1
info:
title: Demo API
version: '1.0'
tags:
- name: WithShortDescription
description: |
first line is not long
second line exists
- name: WithLongDescription
description: |
first line loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
second line exists
paths: {}
components: {}
openapi-cli Version(s)
1.0.0-beta.74
Node.js Version(s)
v16.13.0
I think that the roots of this bug is a default maximum size of the line in a description field.
I tried to search source code with value 80, but found nothing related.
Is there any possible way to turn off lines formatting by maximum size? Or may be way to set maximum size of the line to some big integer value?