Skip to content

Commit 3cf52e7

Browse files
authored
Don't rely on JSON Pointers and strings for marking SchemaTransformer evaluations (#1889)
Fixes: #1890 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 0af421f commit 3cf52e7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/core/jsonschema/transformer.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ auto SchemaTransformer::apply(
147147
const std::optional<JSON::String> &default_id) const -> bool {
148148
// There is no point in applying an empty bundle
149149
assert(!this->rules.empty());
150-
std::set<std::pair<Pointer, JSON::String>> processed_rules;
150+
std::set<std::pair<const JSON *, const JSON::String *>> processed_rules;
151151

152152
bool result{true};
153153
while (true) {
@@ -183,7 +183,8 @@ auto SchemaTransformer::apply(
183183
continue;
184184
}
185185

186-
if (processed_rules.contains({entry.second.pointer, name})) {
186+
std::pair<const JSON *, const JSON::String *> mark{&current, &name};
187+
if (processed_rules.contains(mark)) {
187188
// TODO: Throw a better custom error that also highlights the schema
188189
// location
189190
std::ostringstream error;
@@ -221,7 +222,7 @@ auto SchemaTransformer::apply(
221222
set(schema, reference.first.second, JSON{original.recompose()});
222223
}
223224

224-
processed_rules.emplace(entry.second.pointer, name);
225+
processed_rules.emplace(std::move(mark));
225226
goto core_transformer_start_again;
226227
}
227228
}

0 commit comments

Comments
 (0)