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

[enhancement] check duplicate keys #1269

Closed
fugerit79 opened this issue Dec 15, 2024 · 0 comments · Fixed by #1270
Closed

[enhancement] check duplicate keys #1269

fugerit79 opened this issue Dec 15, 2024 · 0 comments · Fixed by #1270

Comments

@fugerit79
Copy link
Contributor

fugerit79 commented Dec 15, 2024

EDIT(2024-12-16): After advices from PR #1270, the goal has been limited to just warn for duplicate keys on properties config source.

Sometimes happens that the same config name is found multiple time in the same config source.

For instance :

quarkus.bannner.enabled=false
quarkus.bannner.enabled=true

Or

quarkus:
  banner:
    enabled: false
  banner:
    enabled: true

In our quarkus projects (whose configuration is based on smallrye-config) this is just silently ignored.

I know that IDE helps avoiding it and developers should be disciplined when writing configuration, but in our large teams sometimes this happened.

But for a Developer Joy approach, it could be helpful to have an Out Of The Box solution.

For instance we could enable duplicate keys check with a system property like ?

smallrye.config.forbid-duplicate-keys

Note : main goal is to use this feature to che configurations at dev or in the CI

fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 15, 2024
If property :
smallrye.config.forbidDuplicateKeys
is set to true

A ConfigValidationException will be raised if duplicate keys are found in the same config source.

smallrye#1269
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 15, 2024
If property :
smallrye.config.forbidDuplicateKeys
is set to true

A ConfigValidationException will be raised if duplicate keys are found in the same config source.

smallrye#1269
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 15, 2024
If property :
smallrye.config.forbidDuplicateKeys
is set to true

A ConfigValidationException will be raised if duplicate keys are found in the same config source.

smallrye#1269
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 15, 2024
If property :
smallrye.config.forbid-duplicate-keys
is set to true

A ConfigValidationException will be raised if duplicate keys are found in the same config source.

smallrye#1269
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 16, 2024
Only for properties config source : duplicate keys found in te same config source will be logged as warning.
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 19, 2024
Added a log method in ConfigLogging to handle duplicate values.
radcortez pushed a commit that referenced this issue Dec 19, 2024
Added a log method in ConfigLogging to handle duplicate values.
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 19, 2024
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 19, 2024
Only for properties config source : duplicate keys found in te same config source will be logged as warning.
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 19, 2024
Added a log method in ConfigLogging to handle duplicate values.
fugerit79 added a commit to fugerit-org/smallrye-config that referenced this issue Dec 19, 2024
radcortez pushed a commit that referenced this issue Dec 20, 2024
* check duplicate keys (properties) #1269
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant