Comments (2)
Yann,
If your ADT includes a case class
and case object
you'll need to create
a FieldCoproductHint
as described on this page
or allow it to be automatically created by full-auto. That means by default
your config reader would look for type
to specify which member of the ADT
is being loaded. For example, your config from above might look like:
{
auth-conf1 = { type = basic, username=jim, password=secret }
auth-conf2 = { type = disabled }
// etc
}
Does that help?
from pureconfig.
Thanks, I was already using a FieldCoproductHint
.
I've found that I need to add import pureconfig.generic.auto._
.
This works:
import pureconfig._
import pureconfig.generic.FieldCoproductHint
import pureconfig.generic.auto._
import pureconfig.generic.semiauto._
implicit val authenticationConfHint: FieldCoproductHint[AuthenticationConfig] =
new FieldCoproductHint[AuthenticationConfig]("mode")
implicit val config: ConfigReader[AuthenticationConfig] = deriveReader[AuthenticationConfig]
Thanks for the help!
from pureconfig.
Related Issues (20)
- java.lang.NoClassDefFoundError: Could not initialize class io.circe.Decoder$ after Shading HOT 3
- Case class instance unexpectedly shared across map entries HOT 3
- How to use PureConfig in Scala 3? HOT 11
- Ignore NULL values when reading maps HOT 3
- How to use Either as a config type HOT 1
- Key not found with digits in fieldname HOT 1
- Review request HOT 1
- Allow custom ConfigParseOptions
- Is it possible to define ConfigReader for "polymorphic" inputs? HOT 3
- Vulnerability from SnakeYAML CVE-2022-1471 HOT 3
- Scala 3 derivation of ConfigReader doesn't work with default values HOT 3
- Dependency issue with http4s (0.22 vs 0.23) HOT 3
- Tricky case object names HOT 1
- Cannot find an implicit instance of pureconfig.ConfigReader
- Publish Scala 3 Artifacts? HOT 1
- Create a Scala 3 release for pureconfig-circe
- Map unique keys HOT 2
- deriveReader for Scala 3 HOT 1
- Create a release to prevent `version conflict(s) in library dependencies` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pureconfig.