Coder Social home page Coder Social logo

checkValid is broken about config HOT 6 CLOSED

lightbend avatar lightbend commented on July 24, 2024
checkValid is broken

from config.

Comments (6)

havocp avatar havocp commented on July 24, 2024

My guess is that you need memberONE/memberTWO and reference to be at the same "depth".
i.e. both should have the member-config{} outer object or not.

from config.

 avatar commented on July 24, 2024

yes, you are right;
https://github.com/barchart/barchart-inst/blob/master/barchart-inst-store-sql/src/test/java/typesafe/TestCheckValid1.java

but it seems highly counter-intuitive if you think of

final Config memberONE = reference.getConfig("member-config");

as extracted bean properties; what is the way to avoid redundant root object
https://github.com/barchart/barchart-inst/blob/master/barchart-inst-store-sql/src/test/java/typesafe/TestCheckValid1.java

?

from config.

 avatar commented on July 24, 2024

I guess one answer would be:
"the bean should not check its own validity; checkValid should be done by whoever instantiates the bean"
but it does not sound right to me, when there are many places doing instantiation

from config.

 avatar commented on July 24, 2024

current checkValid approach also seems to force use of redundant root to validate list members?

from config.

havocp avatar havocp commented on July 24, 2024

The normal case is assumed to be config.checkValid(reference, "something") where config and reference were from say application.conf and reference.conf, and therefore would have the full paths to everything including "something". The sample lib in examples/ I think shows how the API is expected to be used.

In the latest version you can always use atPath("member-config") or atKey("member-config") to quickly wrap that full path around your config.

You can also solve this by just being consistent about doing the getConfig on both sides of the operation; config.getConfig("member-config").checkValid(reference.getConfig("member-config"))

from config.

 avatar commented on July 24, 2024

ok, got it;

  1. atPath("member-config") seems to be the best way to go

  2. config.getConfig("member-config").checkValid(reference.getConfig("member-config")) is begging
    for an alternative form of checkValid

from config.

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.