Skip to content

fix(base-marshalling): support enum marshalling via registerEnum#42

Merged
deer merged 1 commit intomainfrom
marshal_enums
Apr 16, 2026
Merged

fix(base-marshalling): support enum marshalling via registerEnum#42
deer merged 1 commit intomainfrom
marshal_enums

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented Apr 16, 2026

Enums cannot declare @Marshal/@Unmarshal methods, so there was previously no way to make isMarshallable return true for an enum class. This caused AbstractTraitable.destructor in codemodel to silently drop enum traits — they were filtered out by the marshaller.isMarshallable(trait.getClass()) guard with no error.

Adds SchemaFactory.registerEnum(Class<E>) (and Marshalling.registerEnum) as an explicit opt-in for enum classes, serializing by Enum.name() and deserializing via Enum.valueOf. Also fixes getMarshallingSchema and getUnmarshallingSchemas which were not consulting the enum registry, making them inconsistent with isMarshallable.

@deer deer merged commit 8c763af into main Apr 16, 2026
3 checks passed
@deer deer deleted the marshal_enums branch April 16, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant