Comments (3)
Need to define what the expected behaviour is. e.g. is the "A" case sensitive or not, and how do you handle camel-case names, e.g. "ReadOrWrite" == "readorwrite" or "read-or-write"
from pureconfig.
The case sensitive part and more generally the name format is a problem that I was going to address in future. My idea is to add the possibility to define a function fieldFormat:: String => String
in loadConfig
that the user could use to transform any kind of names to a proper defined name in PureConfig. For instance, the function could convert "ReadOrWrite" to "readorwrite", same for the String "read-or-write" and the format would be configurable and fully compatible with the current system. By default the function would be identity
but a lowercase
version would be available for import.
Another thing to define is if the name of the entity should always be there. PureConfig currently does the following
> case class D(int: Int) extends A
> pureconfig.loadConfig[A](Map("foo.int" -> "1"), "foo")
res2: util.Try[A] = Success(D(1))
but maybe it would be better and more correct to have the name of the entity before the name of the fields in case of families
> pureconfig.loadConfig[A](Map("foo.D.int" -> "1"), "foo")
res2: util.Try[A] = Success(D(1))
In this way, PureConfig would be able to support families with multiple objects and classes with the same fields and this problem would be immediately solved.
from pureconfig.
IMO case classes should be handled differently from "enums".
For an "enum" (eg sealed trait + case objects only) only the value decides the outcome.
Non-enum support would be great but I'd guess it's harder to define the problem and a solution and could be handled as a separate issue.
from pureconfig.
Related Issues (20)
- Case class instance unexpectedly shared across map entries HOT 3
- How to use PureConfig in Scala 3? HOT 10
- 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 1
- 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
- sealed trait with families and enums HOT 2
- Usage question: Loading into case class without derive in Scala 3 HOT 4
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.