Skip to content

Single-quoted multi-line flow scalar ending with a blank line loses indentation level on output #2819

Description

@taisph

Describe the bug
When the source YAML below is run through yq . it ends up with the last single-quote at the wrong/unexpected indentation level.

Version of yq: 4.53.2 4.53.3
Operating system: Ubuntu Linux
Installed via: mise

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
source.yml:

paths:
  /v1/quack:
    get:
      description: '
        Get quacked.

        - Duck

        '

Command
The command you ran:

yq . source.yml

Actual behaviour

paths:
  /v1/quack:
    get:
      description: ' Get quacked.

        - Duck

'

Expected behaviour

paths:
  /v1/quack:
    get:
      description: '
        Get quacked.

        - Duck

        '

Additional context
Oddly, yq treats the output as valid and parsable even though some other tools flag is as incorrect. Also, using double-quoting does not exhibit this behaviour.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions