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

YAML: Spring Boot Escape sequence not working

Open
#1,595 2 comments 0 reactions 1 assignee View on GitHub

@ryanjbaxter is already working on this.

Since Apr 20, 2020.

bug
Dominant language
Java
Stars
2k
Forks
1.3k
Avg merge
2d 59m
Merged PRs (30d)
16

Description

When using a yaml with the spring boot escape sequence of "[key.with.dots]" the conversion will not work and an invalid key exception will be thrown. The Environment Controller expects in between the "[]" a digit index.

Im using spring-cloud-config-server version 2.2.2.RELEASE.

For example this yaml:

webservices:
    "[domain.test:8080]":
        -   username: me
            password: mypassword

throws

java.lang.IllegalArgumentException: Invalid key: webservices[domain.test:8080][0].password
	at org.springframework.cloud.config.server.environment.EnvironmentController$PropertyNavigator.getIndex(EnvironmentController.java:457)
	at org.springframework.cloud.config.server.environment.EnvironmentController$PropertyNavigator.setListValue(EnvironmentController.java:418)
	at org.springframework.cloud.config.server.environment.EnvironmentController$PropertyNavigator.setMapValue(EnvironmentController.java:409)
	at org.springframework.cloud.config.server.environment.EnvironmentController$PropertyNavigator.access$100(EnvironmentController.java:366)
	at org.springframework.cloud.config.server.environment.EnvironmentController.convertToMap(EnvironmentController.java:256)
	at org.springframework.cloud.config.server.environment.EnvironmentController.labelledYaml(EnvironmentController.java:219)
	at org.springframework.cloud.config.server.environment.EnvironmentController.yaml(EnvironmentController.java:208)

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.