Skip to content

Feature Request: Force quotes on a string #4855

@omissis

Description

@omissis

Is your feature request related to a problem?

I have a few cases where the yaml output removes strings from a value that I would like to avoid.
For example, I have some softwares that do not respect semver, and where the version looks like 0.8. Yaml believes that is a number, and other processes downstream break because of this.

I also had issues with fields valued as @local dist/tools/checkmake/0.2.2/packages, as the library removed the quotes, but the leading @ broke the yaml, I will see if I can reproduce this issue, too.

Solution you'd like

maybe having a new finalizers property that allow to do one last round of changes after the yaml value has been generated, such as forceQuotes, eg:

targets:
  melange-yaml-1:
    name: Bump file-lint version
    kind: yaml
    sourceid: file-lint
    scmid: mecha-images
    spec:
      key: $.package.version
      file: tools/file-lint/melange.yaml
    finalizers:
        forceQuotes:
            enable: true
            style: single

Alternatives you've considered

I tried playing with the transformers, but they are too early in the pipeline I believe

Anything else?

Maybe there are some go-yaml configs that can be exposed instead?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions