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

feat: implement Scala 3 Constant and Union support for string-based literals as enums #3846

Conversation

ThijsBroersen
Copy link
Contributor

This PR implements support for string-based literal types. Single-value or Union-based.

Example:

case class Foo(aOrB: "A" | "B", optA: Option["A"]) derives Schema

@adamw
Copy link
Member

adamw commented Jun 14, 2024

Thanks for the PR! I think for completeness it would also be great to have Codec-deriving macros (if these enumerations are used at the top-level, e.g. for query parameters)

@ThijsBroersen
Copy link
Contributor Author

@adamw thanks for the feedback, will process it probably tonight.

@ThijsBroersen
Copy link
Contributor Author

Added both Codec and Validator derivations. Schema and Codec reuse the Validator now.

@adamw adamw merged commit 74aa169 into softwaremill:master Jun 17, 2024
21 checks passed
@adamw
Copy link
Member

adamw commented Jun 17, 2024

Thanks!

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.

2 participants