spring-cloud-config
spring-cloud-config copied to clipboard
Retrieving properties in YAML or JSON format returns manipulated, incorrect property keys
Describe the bug
If a client app, e.g. "TestApp" has a TestApp.properties
file containing properties such as:
hub.server=my.favorite.server
hub.server.timeout.millis=30000
And you call `{CONFIG-SERVER-URL}/dev/TestApp-dev.json'
The response will be:
{
"hub": {
"server": "my.favorite.server",
"timeout": {
"server.millis": "30000"
}
}
}
The issue is that for the "TestApp.hub.server.timeout.millis" property, the "server" part of the path is in the wrong place. If you converted this back to properties it would be:
TestApp.hub.timeout.server.millis=30000
instead of the expected:
TestApp.hub.server.timeout.millis=30000
I would expect something like this, though I'm not 100% sure that this is the correct way to do it. It does pass an online JSON format validator (using JSONLint).
{
"hub": {
"server": "my.favorite.server",
"server.timeout.millis": 30000
}
}
It the answer is that this set of properties can not properly be represented as JSON, then the expected behavior would be that the config server throws an error. It should never manipulate the property keys this way.
Also note that the same issue happens with "yml" format. The response from {CONFIG-SERVER-URL}/dev/TestApp-dev.yml
is:
hub:
server: my.favorite.server
timeout:
server.millis: '30000'
Sample I will attach or link to a project that demonstrates this.