Skip to content

Output Report: Format MultiLine Strings to Yaml Literal Style #9

@gregberns

Description

@gregberns

When fcheck runs a process which emits multi-line output, like logging or a stacktrace, it would be helpful to render the yaml with linebreaks inseead of \n within the string.

Yaml supports block scalars, specifically the 'literal' style, indicated by a pipe (|).

---
tests:
  - name: a
    commands:
      - type: complete
        ...
        stdout: "[INF] Starting...\n[DBG] Table name\n[INF] dbconfig = Data Source=db\n[DBG] Tables: filemaker_rolodex\n[DBG] Anon START[ERR] Faulted: Errors occurred (Count: 1) \nNone\n"

Which would convert the yaml report into something more readable:

---
tests:
  - name: a
    commands:
      - type: complete
        ...
        stdout: |
          [INF] Starting...
          [DBG] Table name
          [INF] dbconfig = Data Source=db
          [DBG] Tables: filemaker_rolodex\n[DBG] Anon START
          [ERR] Faulted: Errors occurred (Count: 1) 
          None

Problem

fcheck is currently using serde-yaml to serialize the yaml. That project is in turn using yaml-rust. There are serveral PRs out to yaml-rust to add support for block literals, but yaml-rust has not been responsive to merging them in.

We could look at using a different serialization library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions