Repository navigation
Conversation
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the configuration-deserialization simplification.
No open issues 🎉
What changed in this PR
Simplifies Config JSON deserialization by deriving property names from constructor parameters while preserving explicit mappings where JSON keys differ.
Changes:
- Removes redundant
@JsonPropertynames while retaining required-property checks. - Registers Jackson’s
ParameterNamesModulefor configuration loading. - Adds the matching Jackson dependency and enables Java’s
-parameterscompiler option.
| File | Description |
|---|---|
| application/src/main/java/org/togetherjava/tjbot/config/Config.java | Simplifies property annotations and registers parameter-name support. |
| application/build.gradle | Adds the Jackson module and preserves constructor parameter names during compilation. |
Review effort: Balanced
Tais993
left a comment
There was a problem hiding this comment.
This change should be documented in the class.
Currently, hard-coded property names make it much easier for beginners to understand how this works. If some simple Javadoc is added that explains how adding a parameter will automatically resolve its value from the config, that would be great
There was a problem hiding this comment.
im not a fan of this part:
options.compilerArgs << '-parameters'
it makes the compilation chain and the project "more complex/fragile" from a setup perspective.
but at the moment i cant say how common/problematic/heavy-weight this is. would need to do some research



Removes the explicit
valuefrom every@JsonPropertyinConfig's@JsonCreatorconstructor. Property names are now taken from the constructor parameter names.Before
After
How
application/build.gradle: compile with-parameters, addjackson-module-parameter-namesConfig: registerParameterNamesModuleon theObjectMapperconfig.jsonkey. Behavior is otherwise unchanged; existing config files load as before.