Skip to content

Support named enums #103

@HarvieKrumpet

Description

@HarvieKrumpet

Just as newtonsoft and system.text have converters to handle

   [JsonStringEnumConverter]
   [StringEnumConverter]
   public enum MyEnum {text, refusal, toolresponse, image, url, filename, b64, block, application, html }

Magic should also support this functionality, as add/removing, or even re-arranging an enum in code will silently break the database versions. by converting to string names. we not only get a solid error if there is a mismatch during deserialization. re-arranging/adding/deleting enums will not break the database.

It just seems to me you can "peek" into the reflection and look for these system.text or newtownsoft attributes without needing to add more MagicAttributes to trigger a converter.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions