matrei commented on PR #16414:
URL: https://github.com/apache/grails-core/pull/16414#issuecomment-6199246375

   One more thing I noticed after posting: nothing at runtime tells an 
application that its JSON output will change in Grails 10.
   
   With `grails.converters.json.legacy` unset, the only log line is the DEBUG 
one in `ConvertersConfigurationInitializer` ("Using the JSON marshallers of 
Grails 8 ..."). The configuration metadata entry has no `deprecation` block 
either. An application that upgrades to 9 and never reads the upgrade guide 
gets no signal before the default flips in 10, and that flip changes the text 
of every `render ... as JSON` response.
   
   Could the initializer log a WARN once at startup, only when the property is 
not set? For example:
   
   ```
   grails.converters.json.legacy is not set, so the JSON converter renders JSON 
as Grails 8 did. Grails 10 renders
   through the application's JsonMapper by default. Set it to true to keep the 
Grails 8 rendering, or to false to
   switch now; see "Rendering JSON As Grails 8 Did" in the upgrade guide.
   ```
   
   - Checking 
`getGrailsConfig().containsProperty(SETTING_CONVERTERS_JSON_LEGACY)` keeps it 
quiet for applications that chose `true` deliberately, so it nudges only the 
ones that haven't decided.
   - A static `AtomicBoolean`, as `GparsPromiseFactory` uses for its 
deprecation warning, keeps it to one line when the initializer runs more than 
once in a JVM, as it does in tests.
   - A test for the three cases (unset warns, `true` and `false` don't) would 
pin it down.
   
   This isn't blocking for me, but it's cheap and it's the only way most users 
will find out before 10.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to