codeconsole commented on PR #15758:
URL: https://github.com/apache/grails-core/pull/15758#issuecomment-4792205895

   Thanks @jdaugherty — both points addressed.
   
   **1. End-to-end `mergeDefaults` demo (app1)**
   
   `app1` now declares *only* a single custom MIME type with merging enabled:
   
   ```yaml
   grails:
       mime:
           mergeDefaults: true
           types:
               vnd: application/vnd.app1.v1+json
   ```
   
   A new `ContentNegotiationController.mergedFormats` action plus two 
`ContentNegotiationSpec` tests prove the behavior over the wire:
   - `Accept: application/vnd.app1.v1+json` → the declared custom type is 
negotiated.
   - `Accept: application/json` → still resolves to JSON **even though only 
`vnd` is declared**, because the framework defaults are merged in.
   
   Crucially, app1's entire existing `ContentNegotiationSpec` (json/xml/html 
negotiation, `respond`, extensions, etc.) continues to pass with only `vnd` 
declared — that is itself the end-to-end proof that `mergeDefaults` brings the 
defaults back in (with `mergeDefaults` off / replace semantics, those would all 
fail).
   
   **2. Removed the redundant default block from the test apps**
   
   Removed the now-redundant `grails.mime.types` block from **44** test apps 
that carried the standard web-profile default set (the exact set the framework 
now supplies). For `app3/4/5` and `geb-context-path` I removed only the 
`types:` map and left their explicit `disable.accept.header.userAgents` opt-in 
intact.
   
   A few apps were intentionally **left as-is** because removing the block 
there is *not* a no-op:
   - **JSON-first / REST-ordered apps** (e.g. `views-functional-tests`, 
`issue-views-182`, the `graphql/*` apps, `hibernate{5,7}/grails-data-service`, 
`mongodb/{test-data-service,gson-templates}`, `async-events-pubsub-demo`): 
these declare `json` first, which makes JSON their **default** response format. 
The framework default order is `all`-first (→ HTML), so dropping the block 
flips the default for a bare `respond` with no `Accept` header and breaks those 
apps' tests. They keep their explicit ordering.
   - **`external-configuration` and `plugins/exploded`**: their specs assert 
`grails.mime.types.*` config values directly (they exercise config access), so 
the explicit block is the thing under test.
   - **Deliberately narrowed sets** (`micronaut-hibernate{5,7}`, 
`spring-dependency-management`, the multi-datasource/multitenant hibernate 
apps, `issue-10279`, `test-phases`): these declare a reduced set on purpose; 
the PR's contract is that a declared map replaces the defaults, so they're 
unaffected and left untouched.
   
   Verified locally by running the affected integration suites (app1 incl. the 
new merge tests, `views-functional-tests`, `external-configuration`, 
`plugins/exploded`, the hibernate tenant apps, and a representative sample of 
the stripped apps), plus `:grails-mimetypes:test`.
   


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