You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@grails.apache.org by "sbglasius (via GitHub)" <gi...@apache.org> on 2025/11/17 15:45:09 UTC
[PR] fix: Re-implemented ContainerRenderer on AbstractJsonViewContainerRenderer [grails-core]
sbglasius opened a new pull request, #15234:
URL: https://github.com/apache/grails-core/pull/15234
* Re-enabled gson view resolver
* `ContainerRenderer` extends `Renderer` fix to generics parameter
* consequence fix, that `Renderer` calls `render(T render, ...` changed to `render(Object render, ...` and thus contract changed back to pre Grails 7.0.x
* New test project to verify outcome.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Re-implemented ContainerRenderer on AbstractJsonViewContainerRenderer [grails-core]
Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius commented on code in PR #15234:
URL: https://github.com/apache/grails-core/pull/15234#discussion_r2538236006
##########
grails-rest-transforms/src/main/groovy/grails/rest/render/Renderer.groovy:
##########
@@ -39,5 +39,5 @@ interface Renderer<T> extends MimeTypeProvider {
* @param object The object to render
* @param context The {@link RenderContext}
*/
- void render(T object, RenderContext context)
+ void render(Object object, RenderContext context)
Review Comment:
I disagree, that it's a breaking change, since that's how it was in Grails 6. It was changed in Grails 7.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Re-implemented ContainerRenderer on AbstractJsonViewContainerRenderer [grails-core]
Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius commented on code in PR #15234:
URL: https://github.com/apache/grails-core/pull/15234#discussion_r2538237871
##########
grails-test-examples/views-functional-tests/src/integration-test/groovy/functional/tests/BookSpec.groovy:
##########
@@ -56,22 +56,17 @@ class BookSpec extends HttpClientSpec {
HttpClientResponseException e = thrown()
e.response.status == HttpStatus.UNPROCESSABLE_ENTITY
e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).isPresent()
- // This has changed somewhere along the way
- // e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/vnd.error;charset=UTF-8'
- // to ->
- e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/json;charset=UTF-8'
- objectMapper.readTree(e.response.body().toString()) == objectMapper.readTree('''
+ e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/vnd.error;charset=UTF-8'
+ objectMapper.readTree(e.response.body().toString()) == objectMapper.readTree("""
{
- "errors": [
- {
- "object": "functional.tests.Book",
- "field": "title",
- "rejected-value": null,
- "message": "Property [title] of class [class functional.tests.Book] cannot be null"
- }
- ]
- }
- ''')
+ "message": "Property [title] of class [class functional.tests.Book] cannot be null",
Review Comment:
Yes, I found it because my client had a custom `_errors.gson` file that was not rendered.
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Re-implemented ContainerRenderer on AbstractJsonViewContainerRenderer [grails-core]
Posted by "sbglasius (via GitHub)" <gi...@apache.org>.
sbglasius merged PR #15234:
URL: https://github.com/apache/grails-core/pull/15234
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix: Re-implemented ContainerRenderer on AbstractJsonViewContainerRenderer [grails-core]
Posted by "jdaugherty (via GitHub)" <gi...@apache.org>.
jdaugherty commented on code in PR #15234:
URL: https://github.com/apache/grails-core/pull/15234#discussion_r2537961038
##########
grails-rest-transforms/src/main/groovy/grails/rest/render/Renderer.groovy:
##########
@@ -39,5 +39,5 @@ interface Renderer<T> extends MimeTypeProvider {
* @param object The object to render
* @param context The {@link RenderContext}
*/
- void render(T object, RenderContext context)
+ void render(Object object, RenderContext context)
Review Comment:
Since this is part of the rest transforms, that means this is an API breaking change. I think we have to do this, but I'm wondering if it should be a 7.1.x bug fix and we just ship 7.1.x sooner.
##########
grails-test-examples/views-functional-tests/src/integration-test/groovy/functional/tests/BookSpec.groovy:
##########
@@ -56,22 +56,17 @@ class BookSpec extends HttpClientSpec {
HttpClientResponseException e = thrown()
e.response.status == HttpStatus.UNPROCESSABLE_ENTITY
e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).isPresent()
- // This has changed somewhere along the way
- // e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/vnd.error;charset=UTF-8'
- // to ->
- e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/json;charset=UTF-8'
- objectMapper.readTree(e.response.body().toString()) == objectMapper.readTree('''
+ e.response.headers.getFirst(HttpHeaders.CONTENT_TYPE).get() == 'application/vnd.error;charset=UTF-8'
+ objectMapper.readTree(e.response.body().toString()) == objectMapper.readTree("""
{
- "errors": [
- {
- "object": "functional.tests.Book",
- "field": "title",
- "rejected-value": null,
- "message": "Property [title] of class [class functional.tests.Book] cannot be null"
- }
- ]
- }
- ''')
+ "message": "Property [title] of class [class functional.tests.Book] cannot be null",
Review Comment:
I assume if there isn't an error.gson, then it does render errors like before?
--
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: notifications-unsubscribe@grails.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org