MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / EnvConfigFromYaml

Function EnvConfigFromYaml

env/env_yaml.cc:1001–1020  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

999} // namespace
1000
1001absl::StatusOr<Config> EnvConfigFromYaml(const std::string& yaml) {
1002 Config config;
1003 CEL_ASSIGN_OR_RETURN(YAML::Node root, LoadYaml(yaml));
1004 if (!root.IsDefined() || root.IsNull()) {
1005 return config;
1006 }
1007
1008 if (!root.IsMap()) {
1009 return absl::InvalidArgumentError(FormatYamlErrorMessage(
1010 yaml, "Invalid CEL environment config YAML", root.Mark()));
1011 }
1012
1013 CEL_RETURN_IF_ERROR(ParseName(config, yaml, root));
1014 CEL_RETURN_IF_ERROR(ParseContainerConfig(config, yaml, root));
1015 CEL_RETURN_IF_ERROR(ParseExtensionConfigs(config, yaml, root));
1016 CEL_RETURN_IF_ERROR(ParseStandardLibraryConfig(config, yaml, root));
1017 CEL_RETURN_IF_ERROR(ParseVariableConfigs(config, yaml, root));
1018 CEL_RETURN_IF_ERROR(ParseFunctionConfigs(config, yaml, root));
1019 return config;
1020}
1021
1022void EnvConfigToYaml(const Config& env_config, std::ostream& os) {
1023 YAML::Emitter out(os);

Callers 1

ASSERT_OK_AND_ASSIGNFunction · 0.85

Calls 9

FormatYamlErrorMessageFunction · 0.85
ParseNameFunction · 0.85
ParseContainerConfigFunction · 0.85
ParseExtensionConfigsFunction · 0.85
ParseVariableConfigsFunction · 0.85
ParseFunctionConfigsFunction · 0.85
IsNullMethod · 0.45
IsMapMethod · 0.45

Tested by 1

ASSERT_OK_AND_ASSIGNFunction · 0.68