redocly-cli icon indicating copy to clipboard operation
redocly-cli copied to clipboard

`bundle` command squash referenced markdown file to one string

Open Boiarshinov opened this issue 4 years ago • 0 comments

Describe the bug

bundle command squash referenced markdown file to one string. I'm not sure is that a bug or a feature absence 😅

To Reproduce Given this OpenAPI file:

openapi: 3.0.1
info:
  title: Demo API
  version: '1.0'
  description:
    $ref: './description.md'
paths: {}

Which has reference to this markdown description:

# Heading
List:
- first item
- second item

Line.
Same Line

Run this command

openapi bundle openapi.yaml --output bundled.yaml

And look at the squashed description in the bundled file:

openapi: 3.0.1
info:
  title: Demo API
  version: '1.0'
  description: "# Heading\r\nList:\r\n- first item\r\n- second item\r\n\r\nLine.\r\nSame Line"
paths: {}
components: {}

FYI: swagger-cli have the same behavior

Expected behavior In my opinion it's better not to squash markdown file to single line but to use multiline strings in literal mode. So the expected bundled file should be:

openapi: 3.0.1
info:
  title: Demo API
  version: '1.0'
  description: |
    # Heading
    List:
    - first item
    - second item

    Line.
    Same Line
paths: {}
components: {}

openapi-cli Version(s) 1.0.0-beta.74

Node.js Version(s) v16.13.0

Boiarshinov avatar Dec 22 '21 21:12 Boiarshinov