Skip to content

Conversation

@codeconsole
Copy link
Contributor

@codeconsole codeconsole commented Nov 5, 2025

The Problem

Grails had asymmetric enum handling that broke round-trips:

POST/PUT (What you send):

{"stage":"SUBMIT"}

GET (What you received back):

{"stage":{"enumType":"com.example.ChallengeStage","name":"SUBMIT"}}

Result: You couldn't POST back what you GET!

The Fix

Enums now serialize the same way they deserialize - as simple strings:

POST/PUT (What you send):

{"stage":"SUBMIT"}

GET (What you get back):

{"stage":"SUBMIT"}

Result: What you POST is what you GET.

Opt-in via application.yml:

 grails: converters: json: enum: format: simple xml: enum: format: simple
@codeconsole codeconsole changed the title 7.0.x simple enum json support 7.0.x - Fix Enum JSON/XML Serialization for Round-Trip Compatibility Nov 5, 2025
@github-actions github-actions bot added the bug label Nov 5, 2025
@jdaugherty
Copy link
Contributor

@codeconsole can you please update the documentation too?

@codeconsole
Copy link
Contributor Author

@codeconsole can you please update the documentation too?

done

@codeconsole codeconsole merged commit 06e8208 into apache:7.0.x Nov 5, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants