12
12
13
13
enum class AnchorType : std::uint8_t { Static, Dynamic, All };
14
14
15
- static auto find_anchors (const sourcemeta::core::JSON &schema,
16
- const sourcemeta::core::Vocabularies &vocabularies)
15
+ namespace {
16
+
17
+ auto find_anchors (const sourcemeta::core::JSON &schema,
18
+ const sourcemeta::core::Vocabularies &vocabularies)
17
19
-> std::map<sourcemeta::core::JSON::String, AnchorType> {
18
20
std::map<sourcemeta::core::JSON::String, AnchorType> result;
19
21
@@ -98,7 +100,7 @@ static auto find_anchors(const sourcemeta::core::JSON &schema,
98
100
return result;
99
101
}
100
102
101
- static auto find_nearest_bases (
103
+ auto find_nearest_bases (
102
104
const std::map<sourcemeta::core::Pointer,
103
105
std::vector<sourcemeta::core::JSON::String>> &bases,
104
106
const sourcemeta::core::Pointer &pointer,
@@ -118,7 +120,7 @@ static auto find_nearest_bases(
118
120
return {{}, sourcemeta::core::empty_pointer};
119
121
}
120
122
121
- static auto find_every_base (
123
+ auto find_every_base (
122
124
const std::map<sourcemeta::core::Pointer,
123
125
std::vector<sourcemeta::core::JSON::String>> &bases,
124
126
const sourcemeta::core::Pointer &pointer)
@@ -145,7 +147,7 @@ static auto find_every_base(
145
147
return result;
146
148
}
147
149
148
- static auto ref_overrides_adjacent_keywords (
150
+ auto ref_overrides_adjacent_keywords (
149
151
const sourcemeta::core::JSON::String &base_dialect) -> bool {
150
152
// In older drafts, the presence of `$ref` would override any sibling
151
153
// keywords
@@ -161,8 +163,7 @@ static auto ref_overrides_adjacent_keywords(
161
163
base_dialect == " http://json-schema.org/draft-03/hyper-schema#" ;
162
164
}
163
165
164
- static auto
165
- supports_id_anchors (const sourcemeta::core::JSON::String &base_dialect)
166
+ auto supports_id_anchors (const sourcemeta::core::JSON::String &base_dialect)
166
167
-> bool {
167
168
return base_dialect == " http://json-schema.org/draft-07/schema#" ||
168
169
base_dialect == " http://json-schema.org/draft-07/hyper-schema#" ||
@@ -172,7 +173,7 @@ supports_id_anchors(const sourcemeta::core::JSON::String &base_dialect)
172
173
base_dialect == " http://json-schema.org/draft-04/hyper-schema#" ;
173
174
}
174
175
175
- static auto fragment_string (const sourcemeta::core::URI &uri)
176
+ auto fragment_string (const sourcemeta::core::URI &uri)
176
177
-> std::optional<sourcemeta::core::JSON::String> {
177
178
const auto fragment{uri.fragment ()};
178
179
if (fragment.has_value ()) {
@@ -183,28 +184,27 @@ static auto fragment_string(const sourcemeta::core::URI &uri)
183
184
}
184
185
185
186
[[noreturn]]
186
- static auto throw_already_exists (const sourcemeta::core::JSON::String &uri)
187
- -> void {
187
+ auto throw_already_exists (const sourcemeta::core::JSON::String &uri) -> void {
188
188
std::ostringstream error;
189
189
error << " Schema identifier already exists: " << uri;
190
190
throw sourcemeta::core::SchemaError (error.str ());
191
191
}
192
192
193
- static auto
194
- store ( sourcemeta::core::SchemaFrame::Locations &frame,
195
- sourcemeta::core::SchemaFrame::Instances &instances,
196
- const sourcemeta::core::SchemaReferenceType type,
197
- const sourcemeta::core::SchemaFrame::LocationType entry_type,
198
- const sourcemeta::core::JSON::String &uri,
199
- const std::optional<sourcemeta::core::JSON::String> &root_id,
200
- const sourcemeta::core::JSON::String &base_id,
201
- const sourcemeta::core::Pointer &pointer_from_root,
202
- const sourcemeta::core::Pointer &pointer_from_base,
203
- const sourcemeta::core::JSON::String &dialect,
204
- const sourcemeta::core::JSON::String &base_dialect,
205
- const std::vector<sourcemeta::core::PointerTemplate> &instance_locations,
206
- const std::optional<sourcemeta::core::Pointer> &parent,
207
- const bool ignore_if_present = false ) -> void {
193
+ auto store (
194
+ sourcemeta::core::SchemaFrame::Locations &frame,
195
+ sourcemeta::core::SchemaFrame::Instances &instances,
196
+ const sourcemeta::core::SchemaReferenceType type,
197
+ const sourcemeta::core::SchemaFrame::LocationType entry_type,
198
+ const sourcemeta::core::JSON::String &uri,
199
+ const std::optional<sourcemeta::core::JSON::String> &root_id,
200
+ const sourcemeta::core::JSON::String &base_id,
201
+ const sourcemeta::core::Pointer &pointer_from_root,
202
+ const sourcemeta::core::Pointer &pointer_from_base,
203
+ const sourcemeta::core::JSON::String &dialect,
204
+ const sourcemeta::core::JSON::String &base_dialect,
205
+ const std::vector<sourcemeta::core::PointerTemplate> &instance_locations,
206
+ const std::optional<sourcemeta::core::Pointer> &parent,
207
+ const bool ignore_if_present = false ) -> void {
208
208
assert (std::set<sourcemeta::core::PointerTemplate>(
209
209
instance_locations.cbegin (), instance_locations.cend ())
210
210
.size () == instance_locations.size ());
@@ -227,7 +227,7 @@ struct InternalEntry {
227
227
const std::optional<sourcemeta::core::JSON::String> id;
228
228
};
229
229
230
- static auto traverse_origin_instance_locations (
230
+ auto traverse_origin_instance_locations (
231
231
const sourcemeta::core::SchemaFrame &frame,
232
232
const sourcemeta::core::SchemaFrame::Instances &instances,
233
233
const sourcemeta::core::Pointer ¤t,
@@ -264,7 +264,7 @@ struct CacheSubschema {
264
264
const std::optional<sourcemeta::core::Pointer> parent;
265
265
};
266
266
267
- static auto repopulate_instance_locations (
267
+ auto repopulate_instance_locations (
268
268
const sourcemeta::core::SchemaFrame &frame,
269
269
const sourcemeta::core::SchemaFrame::Instances &instances,
270
270
const std::map<sourcemeta::core::Pointer, CacheSubschema> &cache,
@@ -314,6 +314,8 @@ static auto repopulate_instance_locations(
314
314
}
315
315
}
316
316
317
+ } // namespace
318
+
317
319
namespace sourcemeta ::core {
318
320
319
321
auto SchemaFrame::to_json () const -> JSON {
0 commit comments