userver: userver/yaml_config/merge_schemas.hpp Source File
Loading...
Searching...
No Matches
merge_schemas.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/yaml_config/merge_schemas.hpp
4/// @brief @copybrief yaml_config::MergeSchemas
5/// @ingroup userver_universal
6
7#include <userver/yaml_config/schema.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace yaml_config {
12
13namespace impl {
14
15void Merge(Schema& destination, Schema&& source);
16
17} // namespace impl
18
19/// @brief Merge parent and child components schemas of static configs
20///
21/// @see @ref static-configs-validation "Static configs validation"
22template <typename ParentComponent>
23Schema MergeSchemas(const std::string& yaml_string) {
24 auto schema = impl::SchemaFromString(yaml_string);
25 impl::Merge(schema, ParentComponent::GetStaticConfigSchema());
26 return schema;
27}
28
29} // namespace yaml_config
30
31USERVER_NAMESPACE_END