|
@@ -1154,12 +1154,12 @@ public:
|
|
|
static auto properties(detail::ParserContext<A> const & context) {
|
|
static auto properties(detail::ParserContext<A> const & context) {
|
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
|
|
|
|
|
|
- std::map<std::string, schema::Node const *> rval;
|
|
|
|
|
|
|
+ constraint::PropertiesConstraint rval;
|
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
|
- rval.emplace(prop, context.child(subschema, prop).node());
|
|
|
|
|
|
|
+ rval.properties.emplace(prop, context.child(subschema, prop).node());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return ptr(constraint::PropertiesConstraint{rval});
|
|
|
|
|
|
|
+ return ptr(std::move(rval));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1310,26 +1310,25 @@ public:
|
|
|
static auto dependencies(detail::ParserContext<A> const & context) {
|
|
static auto dependencies(detail::ParserContext<A> const & context) {
|
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
|
|
|
|
|
|
- std::map<std::string, schema::Node const *> schemas;
|
|
|
|
|
- std::map<std::string, std::unordered_set<std::string>> required;
|
|
|
|
|
|
|
+ constraint::DependenciesConstraint rval;
|
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
|
if (subschema.type() == adapter::Type::Array) {
|
|
if (subschema.type() == adapter::Type::Array) {
|
|
|
// Option 1) dependentRequired
|
|
// Option 1) dependentRequired
|
|
|
for (auto key : subschema.as_array()) {
|
|
for (auto key : subschema.as_array()) {
|
|
|
EXPECT(key.type() == adapter::Type::String);
|
|
EXPECT(key.type() == adapter::Type::String);
|
|
|
- required[prop].insert(key.as_string());
|
|
|
|
|
|
|
+ rval.required[prop].insert(key.as_string());
|
|
|
}
|
|
}
|
|
|
} else if (context.vocab->version() <= schema::Version::Draft03 &&
|
|
} else if (context.vocab->version() <= schema::Version::Draft03 &&
|
|
|
subschema.type() == adapter::Type::String) {
|
|
subschema.type() == adapter::Type::String) {
|
|
|
// Option 2) Special single-element dependentRequired in Draft03
|
|
// Option 2) Special single-element dependentRequired in Draft03
|
|
|
- required[prop].insert(subschema.as_string());
|
|
|
|
|
|
|
+ rval.required[prop].insert(subschema.as_string());
|
|
|
} else {
|
|
} else {
|
|
|
// Option 3) dependentSchemas
|
|
// Option 3) dependentSchemas
|
|
|
- schemas.emplace(prop, context.child(subschema, prop).node());
|
|
|
|
|
|
|
+ rval.subschemas.emplace(prop, context.child(subschema, prop).node());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return ptr(constraint::DependenciesConstraint{.subschemas = schemas, .required = required});
|
|
|
|
|
|
|
+ return ptr(std::move(rval));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1355,12 +1354,12 @@ public:
|
|
|
static auto dependentSchemas(detail::ParserContext<A> const & context) {
|
|
static auto dependentSchemas(detail::ParserContext<A> const & context) {
|
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
|
|
|
|
|
|
- std::map<std::string, schema::Node const *> rval;
|
|
|
|
|
|
|
+ constraint::DependenciesConstraint rval;
|
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
|
- rval.emplace(prop, context.child(subschema, prop).node());
|
|
|
|
|
|
|
+ rval.subschemas.emplace(prop, context.child(subschema, prop).node());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return ptr(constraint::DependenciesConstraint{.subschemas = rval});
|
|
|
|
|
|
|
+ return ptr(std::move(rval));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1385,16 +1384,16 @@ public:
|
|
|
static auto dependentRequired(detail::ParserContext<A> const & context) {
|
|
static auto dependentRequired(detail::ParserContext<A> const & context) {
|
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
EXPECT(context.schema.type() == adapter::Type::Object);
|
|
|
|
|
|
|
|
- std::map<std::string, std::unordered_set<std::string>> rval;
|
|
|
|
|
|
|
+ constraint::DependenciesConstraint rval;
|
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
for (auto [prop, subschema] : context.schema.as_object()) {
|
|
|
EXPECT(subschema.type() == adapter::Type::Array);
|
|
EXPECT(subschema.type() == adapter::Type::Array);
|
|
|
for (auto key : subschema.as_array()) {
|
|
for (auto key : subschema.as_array()) {
|
|
|
EXPECT(key.type() == adapter::Type::String);
|
|
EXPECT(key.type() == adapter::Type::String);
|
|
|
- rval[prop].insert(key.as_string());
|
|
|
|
|
|
|
+ rval.required[prop].insert(key.as_string());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return ptr(constraint::DependenciesConstraint{.subschemas = {}, .required = rval});
|
|
|
|
|
|
|
+ return ptr(std::move(rval));
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|