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

add converter for shapeless singleton literals #1094

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yangzai
Copy link
Contributor

@yangzai yangzai commented Jul 11, 2021

Not sure why you might need this but this PR allows you to constrain config fields to singleton literal values.

Example with Scala 2.13 (you will need Witness for Scala 2.12):

case class Profile(name: "foo", age: 42, theAnswerIsAlways: "traverse")
ConfigSource.string("{ name = foo, age = 42, the-answer-is-always: traverse }").load[Profile]

Technically you could also do the same with refined-pureconfig (e.g. Int Refined Equal[42]) but it's not as neat as with singleton literals.

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