Packages

A type-safe configuration loader for Gleam that supports JSON, YAML, and TOML with automatic format detection, environment variable resolution, and profile-based configuration.

Current section

Files

Jump to
yodel src yodel@validator.erl
Raw

src/yodel@validator.erl

-module(yodel@validator).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([validate_properties/1]).
-file("src/yodel/validator.gleam", 6).
-spec validate_properties(yodel@properties:properties()) -> {ok,
yodel@properties:properties()} |
{error, yodel@errors:config_error()}.
validate_properties(Props) ->
case yodel@properties:size(Props) of
0 ->
_pipe = empty_config,
_pipe@1 = {validation_error, _pipe},
{error, _pipe@1};
1 ->
case yodel@properties:get(Props, <<""/utf8>>) of
{ok, _} ->
_pipe@2 = {invalid_config,
<<"Invalid config: value without key"/utf8>>},
_pipe@3 = {validation_error, _pipe@2},
{error, _pipe@3};
{error, _} ->
_pipe@4 = Props,
{ok, _pipe@4}
end;
_ ->
_pipe@5 = Props,
{ok, _pipe@5}
end.