Giter VIP home page Giter VIP logo

Comments (3)

TeraWilliam avatar TeraWilliam commented on May 26, 2024

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.

melrief avatar melrief commented on May 26, 2024

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.

TeraWilliam avatar TeraWilliam commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.