Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn all serialization to use the value serializer model #39

Open
A248 opened this issue Aug 29, 2023 · 2 comments
Open

Turn all serialization to use the value serializer model #39

A248 opened this issue Aug 29, 2023 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@A248
Copy link
Owner

A248 commented Aug 29, 2023

We should take all the default serialization features of DazzleConf and turn them into value serializers. That way, developers can swap out which serialization mechanisms are used. The default serializers, however, should follow existing DazzleConf practices and require no manual configuration.

This will require us to allow some serializers to match multiple kinds of types. For example, serializing enums must check whether the type is an enum.

@A248 A248 added the enhancement New feature or request label Aug 29, 2023
@A248 A248 added this to the 2.0.0 milestone Aug 29, 2023
@A248
Copy link
Owner Author

A248 commented Aug 30, 2023

We need to consider conflicts in case the developer registers value serializers which apply to common types, as can happen if wildcard matching is employed. Detecting conflicts correctly would be difficult.

Fortunately, developers should rarely need wildcard matching and should understand when doing so. It should be sufficient to scan the serializers until a matching one is found, giving prioritization to later-added serializers so that developers can override the inbuilt serializers easily. For example, I might want to override the inbuilt serialization for one of my enum classes by supporting different names for a variant, but retain default handling for all the other enums.

To assist debugging, we can print the associated value serializer when a user specifies an invalid value. This will be possible easily thanks to colocation of serializer instance with node entry (a detail buried in #40).

@A248
Copy link
Owner Author

A248 commented Aug 31, 2023

Value serializers should be provided a definition cache so that configuration definitions do not need to be passed into them. Then, any serializer implementation may request sub-sections following the classic DazzleConf style. This will therefore enable us to completely implement all serialization in terms of the value serializer model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant