codeconsole opened a new pull request, #15196:
URL: https://github.com/apache/grails-core/pull/15196
# The Problem
Grails had asymmetric enum handling that broke round-trips:
POST/PUT (What you send):
```json
{"stage":"SUBMIT"}
```
GET (What you received back):
```json
{"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):
```json
{"stage":"SUBMIT"}
```
GET (What you get back):
```json
{"stage":"SUBMIT"}
```
Result: What you POST is what you GET.
### Technical Changes
- JSON.java: Handle enums as primitives (like strings, numbers, booleans)
- XML.java: Handle enums as primitives (like strings, numbers, booleans)
- Removed dead code: EnumMarshaller classes (no longer needed)
- Updated tests: Verify symmetric serialization/deserialization
--
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]