Blaze 0.0.1
The ultra high-performance JSON Schema evaluator
Loading...
Searching...
No Matches
output_jsonld.h
1#ifndef SOURCEMETA_BLAZE_OUTPUT_JSONLD_H_
2#define SOURCEMETA_BLAZE_OUTPUT_JSONLD_H_
3
4#ifndef SOURCEMETA_BLAZE_OUTPUT_EXPORT
5#include <sourcemeta/blaze/output_export.h>
6#endif
7
8#include <sourcemeta/core/json.h>
9#include <sourcemeta/core/jsonpointer.h>
10
11#include <sourcemeta/blaze/evaluator.h>
12#include <sourcemeta/blaze/output_simple.h>
13
14#include <array> // std::array
15#include <cstdint> // std::uint8_t
16#include <optional> // std::optional
17#include <string> // std::string
18#include <variant> // std::variant
19#include <vector> // std::vector
20
21namespace sourcemeta::blaze {
22
26inline constexpr std::array<sourcemeta::core::JSON::StringView, 13>
27 JSONLD_KEYWORDS{{"x-jsonld-id", "x-jsonld-type", "x-jsonld-reverse",
28 "x-jsonld-datatype", "x-jsonld-language",
29 "x-jsonld-direction", "x-jsonld-json", "x-jsonld-graph",
30 "x-jsonld-container", "x-jsonld-self", "x-jsonld-override",
31 "x-jsonld-value", "x-jsonld-constants"}};
32
35enum class JSONLDFacet : std::uint8_t {
36 Type,
37 Predicate,
38 Datatype,
39 Language,
40 Direction,
41 Graph,
42 JSON,
43 Container,
44 Self,
45 Override,
46 ValuePredicate,
47 Constants
48};
49
55 sourcemeta::core::Pointer instance_location;
56 JSONLDFacet facet;
57 std::string message;
59 std::string schema_location;
62 std::optional<std::string> conflicting_schema_location;
65 std::optional<std::string> inert_override_location;
66};
67
71using JSONLDInvalid = std::vector<SimpleOutput::Entry>;
72
77 std::variant<sourcemeta::core::JSON, JSONLDInvalid, JSONLDResolutionError>;
78
125auto SOURCEMETA_BLAZE_OUTPUT_EXPORT
126jsonld(Evaluator &evaluator, const Template &schema,
127 const sourcemeta::core::JSON &instance) -> JSONLDOutcome;
128
129} // namespace sourcemeta::blaze
130
131#endif
Definition evaluator.h:83
Definition evaluator.h:38
std::string schema_location
The schema location of the annotation the error is about.
Definition output_jsonld.h:59
std::optional< std::string > conflicting_schema_location
Definition output_jsonld.h:62
std::optional< std::string > inert_override_location
Definition output_jsonld.h:65
std::vector< SimpleOutput::Entry > JSONLDInvalid
Definition output_jsonld.h:71
JSONLDFacet
Definition output_jsonld.h:35
std::variant< sourcemeta::core::JSON, JSONLDInvalid, JSONLDResolutionError > JSONLDOutcome
Definition output_jsonld.h:76
constexpr std::array< sourcemeta::core::JSON::StringView, 13 > JSONLD_KEYWORDS
Definition output_jsonld.h:27
auto jsonld(Evaluator &evaluator, const Template &schema, const sourcemeta::core::JSON &instance) -> JSONLDOutcome
Definition output_jsonld.h:54