Skip to content

Conversation

@sbglasius
Copy link
Contributor

@sbglasius sbglasius commented Nov 17, 2025

…derer

* 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.
@sbglasius sbglasius force-pushed the fix/issue_15228-respond-errors branch from 5ef8b65 to 1c7fa75 Compare November 18, 2025 07:50
@sbglasius sbglasius moved this to In Progress in Apache Grails Nov 18, 2025
@sbglasius sbglasius added this to the grails:7.0.3 milestone Nov 18, 2025
Copy link
Contributor

@matrei matrei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid! Good find and fix. Thanks for adding functional test.

Copy link
Contributor

@jdaugherty jdaugherty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is the API change and putting this in 7.0.x. I understand that this is a critical bug fix, but given that we were wanting to do 7.1.x in November anyhow, should we instead promote 7.1.x sooner?

* @param context The {@link RenderContext}
*/
void render(T object, RenderContext context)
void render(Object object, RenderContext context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, that it's a breaking change, since that's how it was in Grails 6. It was changed in Grails 7.

]
}
''')
"message": "Property [title] of class [class functional.tests.Book] cannot be null",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume if there isn't an error.gson, then it does render errors like before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I found it because my client had a custom _errors.gson file that was not rendered.

Copy link
Contributor

@jamesfredley jamesfredley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sbglasius for finding a solution. My changes in September 2024 allowed grails-views to compile on Groovy 4, but I was worried we would run into some issue, at some point and these issues tracked that, for many months:
apache/grails-views#582
#14199

@sbglasius sbglasius merged commit 49ced81 into 7.0.x Nov 18, 2025
36 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Apache Grails Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

respond with Errors does not render view errors/_errors.gson Restore implements ContainerRenderer<C, T> on AbstractJsonViewContainerRenderer<C,T>

4 participants