spring-cloud / spring-cloud/spring-cloud-config

YAML: dotted attributes escape sequence

Open
#2,327 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

waiting-for-triage
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

When querying Spring Cloud Config with a dotted YAML attribute, it gets split into multiple lines:

Source file (application.yml):

appName: sample-app
metadata:
  name: ${appName}
  annotations:
    app.acme.com/source: https://github.com/acme/${appName}

Expected output:

appName: sample-app
metadata:
  name: sample-app
  annotations:
    app.acme.com/source: https://github.com/acme/sample-app

Actual output:

appName: sample-app
metadata:
  name: sample-app
  annotations:
    app:
      acme:
        com/source: https://github.com/acme/sample-app

I have tried escaping the dots multiple ways, none of them worked, except for one "hack" workaround:

Source:

metadata:
  name: sample-app
  annotations:
    default:
      app.acme.com/source: https://github.com/acme/sample-app
    double:
      "app.acme.com/source": https://github.com/acme/sample-app
    single:
      'app.acme.com/source': https://github.com/acme/sample-app
    doubleBr:
      "[app.acme.com/source]": https://github.com/acme/sample-app
    singleBr:
      '[app.acme.com/source]': https://github.com/acme/sample-app
    # Working workaround
    hack:
      ${x-dottedAttribute}/source: https://github.com/acme/sample-app
    # Not working workaround
    hackNested:
      ${x-dottAtts.acme}/source: ${x-dottAtts.acme}/source
    # # Not working workaround returning HTTP 400
    # hackList:
    #   ${x-dottAttList[0]}/source: ${x-dottAttList[0]}/source
x-dottAttList:
  - app.acme.com
x-dottAtts:
  acme: app.acme.com
x-dottedAttribute: app.acme.com

Output:

metadata:
  name: sample-app
  annotations:
    default:
      app:
        acme:
          com/source: https://github.com/acme/sample-app
    double:
      app:
        acme:
          com/source: https://github.com/acme/sample-app
    single:
      app:
        acme:
          com/source: https://github.com/acme/sample-app
    hack:
      app.acme.com/source: https://github.com/acme/sample-app
    hackNested:
      acme/source: app.acme.com/source
    doubleBr[app:
      acme:
        com/source]: https://github.com/acme/sample-app
    singleBr[app:
      acme:
        com/source]: https://github.com/acme/sample-app
x-dottAtts:
  acme: app.acme.com
x-dottedAttribute: app.acme.com
x-dottAttList:
  - app.acme.com

I am using the latest Spring Cloud Config version 4.0.4 (using hyness/spring-cloud-config-server:4.0.4-jre17 docker image from dockerhub), Spring Boot v3.1.2, Java 17.0.7, "native" profile.

This might be related to the existing https://github.com/spring-cloud/spring-cloud-config/issues/1595 issue.

Is there a way to "escape" the dots in attribute so that Config Server would not interpret them? Is this expected behavior?

Thank you very much for your help.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the application.yml reproduction against Spring Cloud Config Server using the native profile, and compare it with issue #1595. Verify how dotted annotation keys are transformed and whether the expected output preserves them; done means the supplied example no longer splits the key and the behavior is covered by regression verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.