Skip to content

encoding a Map[String, String] should encode keys and values as Yaml Strings, even if some of them look like Ints or other scalars #361

Description

@adriaanm

Example:

scala> Map("a" -> "1").asYaml
val res6: String = "a: 1
"

I would expect the yaml to be

a : "1"

as with #220, this is problematic in kubernetes when encoding e.g. maps of labels.

I managed a workaround for now: s"\"${value}\"".asNode, but it would be nice if

  object ScalarNode {
    def apply(value: String): ScalarNode = new ScalarNode(value, Tag.resolveTag(value))

could be generalised a bit so we can pass the style argument to resolveTag (at least).

However, I would argue that when you encode a Map[String, String] you should only get Yaml Strings in your values. For a Map[String, Any] I could imagine wanting to resolve the tags.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions