Reasons why we might fail to parse a value from the config file
General reasons for why a config value might fail to be validated by validate
.
Constructs and instance of the case class ValidConfig
from a list of validated parameter values.
Constructs and instance of the case class ValidConfig
from a list of validated parameter values.
the case class type that we are to construct
list of validated case class parameters (listed in the order they are declared in the case class)
either a list of ValueErrors
(wrapped in a ConfigError) or the validated case class ValidConfig
Used to read in a value of type Value
.
Used to read in a value of type Value
. Other than checking the values type, no other validation is performed.
type we expect the parsed and checked config value to have
Typesafe config path to the value we are validating
the currently in scope config object that we use
Ficus ValueReader
that we use for type checking the parsed config value
either a ValueFailure
or the parsed and *unchecked* Value
instance
Used to read in a value of type Value
and to then check that value using check
.
Used to read in a value of type Value
and to then check that value using check
. If check
returns false,
then we fail with failureReason
.
type we expect the parsed and checked config value to have
Typesafe config path to the value we are validating
if check
fails, the Throwable instance we return
predicate used to check the configuration value
the currently in scope config object that we use
Ficus ValueReader
that we use for type checking the parsed config value
either a ValueFailure
or the parsed and checked Value
instance
Loads Typesafe config file and then builds the validated case class ValidConfig
Loads Typesafe config file and then builds the validated case class ValidConfig
the case class type that we are to construct
the root Typesafe config file name
the builder and validator that we will use to construct the ValidConfig
instance
either a ConfigError throwable instance or the validated case class ValidConfig
The currently in-scope implicit Config
instance is restricted to a specified path
The currently in-scope implicit Config
instance is restricted to a specified path
the case class type that we are to construct
we restrict our Typesafe config path to this path
configuration builder that we will apply to the restricted Config
object
the current in-scope Config
object that we need to path restrict
either a ValueError or the validated case class ValidConfig
Using Typesafe config we read in and parse configuration files. Paths into these files are then retrieved and type checked using Ficus.
Using a lightweight DSL, we are able to then check and validate these type checked values. For example, given that the Typesafe configuration:
has been parsed and read into an implicit of type
Config
, then we are able to validate that the value at the pathtest.nestedVal
has typeDouble
and that it satisfies specified size bounds as follows:If the configuration value at path
test.nestedVal
fails to pass the percentage bounds check, thenLeft(ShouldBeAPercentageValue)
is returned.Likewise, we can enforce that all values in the array at the path
test.context.valueStrList
match the regular expression pattern[a-z0-9]+:[0-9]+
as follows:In some instances, we may not care about checking the value at a configuration path. In these cases we can use
unchecked
:unchecked[FiniteDuration]("test.nestedDuration")