MCPcopy Create free account
hub / github.com/pboettch/json-schema-validator / insert

Method insert

src/json-validator.cpp:182–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

180 content_checker &content_check() { return content_check_; }
181
182 void insert(const json_uri &uri, const std::shared_ptr<schema> &s)
183 {
184 auto &file = get_or_create_file(uri.location());
185 auto sch = file.schemas.lower_bound(uri.fragment());
186 if (sch != file.schemas.end() && !(file.schemas.key_comp()(uri.fragment(), sch->first))) {
187 throw std::invalid_argument("schema with " + uri.to_string() + " already inserted");
188 return;
189 }
190
191 file.schemas.insert({uri.fragment(), s});
192
193 // was someone referencing this newly inserted schema?
194 auto unresolved = file.unresolved.find(uri.fragment());
195 if (unresolved != file.unresolved.end()) {
196 unresolved->second->set_target(s);
197 file.unresolved.erase(unresolved);
198 }
199 }
200
201 void insert_unknown_keyword(const json_uri &uri, const std::string &key, json &value)
202 {

Callers 5

root_schemaClass · 0.80
get_or_create_refMethod · 0.80
numericMethod · 0.80
objectMethod · 0.80
makeMethod · 0.80

Calls 3

locationMethod · 0.80
to_stringMethod · 0.80
set_targetMethod · 0.80

Tested by

no test coverage detected