Skip to content

in yaml, a ~ key should allow to assing a value to the parent key #506

@rmanibus

Description

@rmanibus

In Yaml spec, if one property is the prefix of another, a value can be attributed to the parent one using ~ as a null key to represent any YAML property that is a prefix of another one.

The following test is failing:

    public void testTildeIsDeserializedAsNullKey() throws Exception
    {
        final String YAML =
                "quarkus:\n" +
                        "  log:\n" +
                        "    sentry:\n" +
                        "      ~: true\n" +
                        "      dsn: 'some string'";

        JsonNode node = MAPPER.readValue(YAML, JsonNode.class);
        assertTrue(node.get("quarkus").get("log").get("sentry").booleanValue());
    }

instead, the following statement is true:

assertTrue(node.get("quarkus").get("log").get("sentry").get("~").booleanValue())

quarkus.log.sentry."~" is true instead of quarkus.log.sentry

Relevant conversation:

https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/yaml.20property.20conflict

Relevant spec:

https://quarkus.io/guides/config-yaml#configuration-property-conflicts

https://yaml.org/spec/1.2.2/

Metadata

Metadata

Assignees

No one assigned

    Labels

    yamlIssue related to YAML format backend

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions