Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving properties in YAML or JSON format returns manipulated, incorrect property keys #2423

Open
marnee01 opened this issue May 28, 2024 · 1 comment

Comments

@marnee01
Copy link
Contributor

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.

@marnee01
Copy link
Contributor Author

marnee01 commented May 28, 2024

Here is a project that demonstrates the issues. The "TestApp.properties" file is under the resources/config folder.
ResolvePropertiesConfigServer.zip

  1. Unzip the app.
  2. Run the app as usual
  3. Send request: http://localhost:8080/dev/TestApp-dev.yml or http://localhost:8080/dev/TestApp-dev.json

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

No branches or pull requests

1 participant