Sourcemeta Core 0.0.0
Loading...
Searching...
No Matches
jsonschema_dependencies.h
1#ifndef SOURCEMETA_CORE_JSONSCHEMA_DEPENDENCIES_H_
2#define SOURCEMETA_CORE_JSONSCHEMA_DEPENDENCIES_H_
3
4#ifndef SOURCEMETA_CORE_JSONSCHEMA_EXPORT
5#include <sourcemeta/core/jsonschema_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9#include <sourcemeta/core/jsonpointer.h>
10
11#include <sourcemeta/core/jsonschema_frame.h>
12#include <sourcemeta/core/jsonschema_types.h>
13
14#include <cstdint> // std::uint64_t
15#include <functional> // std::equal_to, std::function, std::hash
16#include <limits> // std::numeric_limits
17#include <string_view> // std::string_view
18
19namespace sourcemeta::core {
20
34 std::string_view origin;
36 const sourcemeta::core::WeakPointer &pointer;
38 std::string_view destination;
45};
46
49using SchemaDependencyCallback = std::function<void(const SchemaDependency &)>;
50
59 using AccountedPredicate = std::function<bool(std::string_view)>;
61 using AccountedCallback = std::function<void(std::string_view)>;
63 using UnresolvedCallback = std::function<void(const SchemaDependency &)>;
64
66 std::string_view default_dialect{};
71 std::string_view default_id{};
83 std::string_view default_base{};
94 std::uint64_t max_locations{std::numeric_limits<std::uint64_t>::max()};
121};
122
184SOURCEMETA_CORE_JSONSCHEMA_EXPORT
186 const SchemaWalker &walker,
187 const SchemaResolver &resolver,
188 const SchemaDependencyCallback &callback,
189 const SchemaDependenciesOptions &options = {})
190 -> std::uint64_t;
191
192} // namespace sourcemeta::core
193
194#endif
Definition json_value.h:39
const WeakPointer EMPTY_WEAK_POINTER
Definition jsonpointer.h:56
GenericPointer< std::reference_wrapper< const std::string >, PropertyHashJSON< JSON::String > > WeakPointer
Definition jsonpointer.h:46
std::vector< sourcemeta::core::WeakPointer > Paths
A list of paths to frame within a schema wrapper.
Definition jsonschema_frame.h:164
std::string_view default_id
Definition jsonschema_dependencies.h:71
UnresolvedCallback unresolved
Definition jsonschema_dependencies.h:113
std::string_view default_base
Definition jsonschema_dependencies.h:83
std::function< void(const SchemaDependency &)> UnresolvedCallback
A callback to report every reference that nothing came to answer for.
Definition jsonschema_dependencies.h:63
AccountedPredicate accounted
Definition jsonschema_dependencies.h:104
std::string_view default_dialect
The dialect to assume for a schema that declares none.
Definition jsonschema_dependencies.h:66
std::uint64_t max_locations
Definition jsonschema_dependencies.h:94
const sourcemeta::core::JSON * document
Definition jsonschema_dependencies.h:44
AccountedCallback accounted_callback
Definition jsonschema_dependencies.h:120
std::string_view destination
The identifier of the document that the reference leads to.
Definition jsonschema_dependencies.h:38
std::string_view origin
Definition jsonschema_dependencies.h:34
std::function< void(std::string_view)> AccountedCallback
A callback to report every URI that analysis comes to account for.
Definition jsonschema_dependencies.h:61
std::function< bool(std::string_view)> AccountedPredicate
A predicate to ask whether the caller already accounts for a URI.
Definition jsonschema_dependencies.h:59
SchemaFrame::Paths paths
Definition jsonschema_dependencies.h:78
std::function< void(const SchemaDependency &)> SchemaDependencyCallback
Definition jsonschema_dependencies.h:49
SOURCEMETA_CORE_JSONSCHEMA_EXPORT auto schema_dependencies(const sourcemeta::core::JSON &schema, const SchemaWalker &walker, const SchemaResolver &resolver, const SchemaDependencyCallback &callback, const SchemaDependenciesOptions &options={}) -> std::uint64_t
std::function< SchemaResolverResult(std::string_view)> SchemaResolver
Definition jsonschema_types.h:41
std::function< const SchemaWalkerResult &( std::string_view, const SchemaVocabularies &)> SchemaWalker
Definition jsonschema_types.h:254
Definition jsonschema_dependencies.h:57
Definition jsonschema_dependencies.h:29