codeconsole commented on code in PR #16414:
URL: https://github.com/apache/grails-core/pull/16414#discussion_r4249145342


##########
grails-converters/src/main/groovy/org/grails/web/converters/configuration/ConvertersConfigurationInitializer.java:
##########
@@ -111,26 +132,75 @@ private void initJSONConfiguration() {
 
         List<ObjectMarshaller<JSON>> marshallers = new ArrayList<>();
         marshallers.addAll(getPreviouslyConfiguredMarshallers(JSON.class));
-        marshallers.add(new 
org.grails.web.converters.marshaller.json.ArrayMarshaller());
-        marshallers.add(new 
org.grails.web.converters.marshaller.json.ByteArrayMarshaller());
-        marshallers.add(new 
org.grails.web.converters.marshaller.json.CollectionMarshaller());
-        marshallers.add(new 
org.grails.web.converters.marshaller.json.MapMarshaller());
-        marshallers.add(new 
org.grails.web.converters.marshaller.json.SimpleEnumMarshaller());
 
         Config grailsConfig = getGrailsConfig();
+        ProxyHandler proxyHandler = getProxyHandler();
+        boolean legacy = 
grailsConfig.getProperty(SETTING_CONVERTERS_JSON_LEGACY, Boolean.class, false);

Review Comment:
   Inverted in 6e9b680773. In 9, `grails.converters.json.legacy` defaults to 
`true`, so the converter renders JSON as Grails 8 did. An application opts into 
the mapper with `legacy: false`, and Grails 10 makes that the default. The 
setting stays undeprecated, and nothing is logged.
   
   - The initializer, `ConvertersConfigurationHolder` and the configuration 
metadata default to `true`.
   - The specs for the mapper path opt in explicitly.
   - `Grails8JsonRenderingSpec` has a feature for the default with no setting 
at all: every value, both pretty print paths and the 11 domain scenarios match 
the 8.0.x text.
   - The edits this PR had made to existing tests only because the default 
changed are reverted, so those files are identical to 9.0.x again: 
`JsonDateTimeRenderingSpec`, the app1 and hibernate7/app1 date marshaller 
controllers and specs, and `MonthBindingSpec`'s comment.
   - Section 1 of the guide and the REST guide now describe the mapper as an 
opt-in that Grails 10 makes the default.
   
   This also corrects the cross-PR story I posted: in 9, the converter renders 
Grails 8's JSON by default, rather than writing through the mapper. With #16237 
keeping `respond()` on the converter in 9, an application's JSON stays as 
Grails 8 rendered it unless it opts in, apart from what Grails 8 failed to 
render or rendered as invalid JSON. Both layers then flip in 10.
   
   The 12 suites pass again: 3,769 tests, including the full `app1` and 
`hibernate7/app1` functional suites.



-- 
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