| 567 | } |
| 568 | |
| 569 | absl::StatusOr<Config::FunctionOverloadConfig> ParseFunctionOverloadConfig( |
| 570 | absl::string_view yaml, const YAML::Node& overload) { |
| 571 | Config::FunctionOverloadConfig overload_config; |
| 572 | if (!overload || !overload.IsMap()) { |
| 573 | return YamlError(yaml, overload, "Function overload is not a map"); |
| 574 | } |
| 575 | const YAML::Node id = overload["id"]; |
| 576 | if (id.IsDefined()) { |
| 577 | if (!id.IsScalar()) { |
| 578 | return YamlError(yaml, id, "Function overload id is not a string"); |
| 579 | } |
| 580 | overload_config.overload_id = GetString(yaml, id); |
| 581 | } |
| 582 | const YAML::Node examples = overload["examples"]; |
| 583 | if (examples.IsDefined()) { |
| 584 | if (!examples.IsSequence()) { |
| 585 | return YamlError(yaml, examples, |
| 586 | "Function overload examples is not a sequence"); |
| 587 | } |
| 588 | for (const YAML::Node& example : examples) { |
| 589 | if (!example.IsScalar()) { |
| 590 | return YamlError(yaml, example, |
| 591 | "Function overload example is not a string"); |
| 592 | } |
| 593 | overload_config.examples.push_back(GetString(yaml, example)); |
| 594 | } |
| 595 | } |
| 596 | |
| 597 | const YAML::Node target = overload["target"]; |
| 598 | if (target.IsDefined()) { |
| 599 | if (!target.IsMap()) { |
| 600 | return YamlError(yaml, target, "Function overload target is not a map"); |
| 601 | } |
| 602 | CEL_ASSIGN_OR_RETURN(Config::TypeInfo type_info, |
| 603 | ParseTypeInfo(target, yaml)); |
| 604 | overload_config.is_member_function = true; |
| 605 | overload_config.parameters.push_back(type_info); |
| 606 | } |
| 607 | |
| 608 | const YAML::Node args = overload["args"]; |
| 609 | if (args.IsDefined()) { |
| 610 | if (!args.IsSequence()) { |
| 611 | return YamlError(yaml, args, "Function overload args is not a sequence"); |
| 612 | } |
| 613 | for (const YAML::Node& arg : args) { |
| 614 | if (!arg.IsMap()) { |
| 615 | return YamlError(yaml, arg, "Function overload arg is not a map"); |
| 616 | } |
| 617 | CEL_ASSIGN_OR_RETURN(Config::TypeInfo type_info, |
| 618 | ParseTypeInfo(arg, yaml)); |
| 619 | overload_config.parameters.push_back(type_info); |
| 620 | } |
| 621 | } |
| 622 | |
| 623 | const YAML::Node return_type = overload["return"]; |
| 624 | if (return_type.IsDefined()) { |
| 625 | if (!return_type.IsMap()) { |
| 626 | return YamlError(yaml, return_type, |
nothing calls this directly
no test coverage detected