File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed
Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 11#include " node_config_file.h"
2+ #include " ata.h"
23#include " debug_utils-inl.h"
4+ #include " node_config_schema.h"
35#include " simdjson.h"
46
57#include < string>
@@ -323,6 +325,32 @@ ParseResult ConfigReader::ParseConfig(const std::string_view& config_path) {
323325 }
324326 }
325327
328+ // Validate against JSON Schema. Skip additionalProperties errors
329+ // because unknown namespaces are intentionally ignored.
330+ {
331+ auto schema = ata::compile (kNodeConfigSchema );
332+ if (schema) {
333+ auto result = ata::validate (schema, file_content);
334+ if (!result.valid ) {
335+ for (const auto & err : result.errors ) {
336+ if (err.code != ata::error_code::additional_property_not_allowed) {
337+ FPrintF (
338+ stderr, " Invalid configuration in %s:\n " , config_path.data ());
339+ for (const auto & e : result.errors ) {
340+ if (e.code != ata::error_code::additional_property_not_allowed) {
341+ FPrintF (stderr,
342+ " %s: %s\n " ,
343+ e.path .empty () ? " /" : e.path ,
344+ e.message );
345+ }
346+ }
347+ return ParseResult::InvalidContent;
348+ }
349+ }
350+ }
351+ }
352+ }
353+
326354 return ParseResult::Valid;
327355}
328356
Original file line number Diff line number Diff line change 33#include " ada.h"
44#include " amaro_version.h"
55#include " ares.h"
6+ #include " ata.h"
67#include " brotli/encode.h"
78#include " llhttp.h"
89#include " merve.h"
@@ -171,6 +172,7 @@ Metadata::Versions::Versions() {
171172#endif // HAVE_SQLITE
172173 ada = ADA_VERSION;
173174 nbytes = NBYTES_VERSION;
175+ ata = ATA_VERSION;
174176}
175177
176178std::array<std::pair<std::string_view, std::string_view>,
Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ namespace node {
6464 V (nghttp3) \
6565 NODE_VERSIONS_KEY_AMARO (V) \
6666 NODE_VERSIONS_KEY_UNDICI (V) \
67- V (merve)
67+ V (merve) \
68+ V (ata)
6869
6970#if HAVE_OPENSSL
7071#define NODE_VERSIONS_KEY_CRYPTO (V ) V(openssl) V(ncrypto)
You can’t perform that action at this time.
0 commit comments