mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 13:44:58 +00:00
ROADMAP.md
This commit is contained in:
25
src/services/impl/json_config_schema_path_resolver.cpp
Normal file
25
src/services/impl/json_config_schema_path_resolver.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "json_config_schema_path_resolver.hpp"
|
||||
|
||||
#include <system_error>
|
||||
#include <vector>
|
||||
|
||||
namespace sdl3cpp::services::impl::json_config {
|
||||
|
||||
std::filesystem::path JsonConfigSchemaPathResolver::Resolve(const std::filesystem::path& configPath) const {
|
||||
const std::filesystem::path schemaFile = "runtime_config_v2.schema.json";
|
||||
std::vector<std::filesystem::path> candidates;
|
||||
if (!configPath.empty()) {
|
||||
candidates.push_back(configPath.parent_path() / "schema" / schemaFile);
|
||||
}
|
||||
candidates.push_back(std::filesystem::current_path() / "config" / "schema" / schemaFile);
|
||||
|
||||
std::error_code ec;
|
||||
for (const auto& candidate : candidates) {
|
||||
if (!candidate.empty() && std::filesystem::exists(candidate, ec)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace sdl3cpp::services::impl::json_config
|
||||
28
src/services/impl/json_config_schema_validator.hpp
Normal file
28
src/services/impl/json_config_schema_validator.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
|
||||
namespace sdl3cpp::services {
|
||||
class ILogger;
|
||||
class IProbeService;
|
||||
}
|
||||
|
||||
namespace sdl3cpp::services::impl::json_config {
|
||||
|
||||
class JsonConfigSchemaValidator {
|
||||
public:
|
||||
JsonConfigSchemaValidator(std::shared_ptr<ILogger> logger,
|
||||
std::shared_ptr<IProbeService> probeService);
|
||||
|
||||
void ValidateOrThrow(const rapidjson::Document& document,
|
||||
const std::filesystem::path& configPath) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<ILogger> logger_;
|
||||
std::shared_ptr<IProbeService> probeService_;
|
||||
};
|
||||
|
||||
} // namespace sdl3cpp::services::impl::json_config
|
||||
7
src/services/impl/json_config_schema_version.hpp
Normal file
7
src/services/impl/json_config_schema_version.hpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace sdl3cpp::services::impl::json_config {
|
||||
|
||||
constexpr int kRuntimeConfigSchemaVersion = 2;
|
||||
|
||||
} // namespace sdl3cpp::services::impl::json_config
|
||||
Reference in New Issue
Block a user