weh
This commit is contained in:
parent
bd402f57f5
commit
3ea546fe08
166 changed files with 18360 additions and 18199 deletions
|
@ -15,8 +15,8 @@ namespace rfl::json::schema {
|
|||
template <class T>
|
||||
struct JSONSchema {
|
||||
Rename<"$schema", Literal<"https://json-schema.org/draft/2020-12/schema">>
|
||||
schema;
|
||||
Flatten<T> root;
|
||||
schema;
|
||||
Flatten<T> root;
|
||||
std::map<std::string, Type> definitions;
|
||||
};
|
||||
|
||||
|
|
|
@ -16,21 +16,21 @@ namespace rfl::json::schema {
|
|||
struct Type {
|
||||
struct Boolean {
|
||||
std::optional<std::string> description;
|
||||
Literal<"boolean"> type;
|
||||
Literal<"boolean"> type;
|
||||
};
|
||||
|
||||
struct Integer {
|
||||
Literal<"integer"> type;
|
||||
Literal<"integer"> type;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct Number {
|
||||
Literal<"number"> type;
|
||||
Literal<"number"> type;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct String {
|
||||
Literal<"string"> type;
|
||||
Literal<"string"> type;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
|
@ -38,119 +38,120 @@ namespace rfl::json::schema {
|
|||
|
||||
struct AllOf {
|
||||
std::optional<std::string> description;
|
||||
std::vector<Type> allOf;
|
||||
std::vector<Type> allOf;
|
||||
};
|
||||
|
||||
struct AnyOf {
|
||||
std::optional<std::string> description;
|
||||
std::vector<Type> anyOf;
|
||||
std::vector<Type> anyOf;
|
||||
};
|
||||
|
||||
struct ExclusiveMaximum {
|
||||
std::optional<std::string> description;
|
||||
std::variant<double, int> exclusiveMaximum;
|
||||
std::string type;
|
||||
std::variant<double, int> exclusiveMaximum;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct ExclusiveMinimum {
|
||||
std::optional<std::string> description;
|
||||
std::variant<double, int> exclusiveMinimum;
|
||||
std::string type;
|
||||
std::variant<double, int> exclusiveMinimum;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct FixedSizeTypedArray {
|
||||
Literal<"array"> type;
|
||||
Literal<"array"> type;
|
||||
std::optional<std::string> description;
|
||||
rfl::Ref<Type> items;
|
||||
size_t minContains;
|
||||
size_t maxContains;
|
||||
rfl::Ref<Type> items;
|
||||
size_t minContains;
|
||||
size_t maxContains;
|
||||
};
|
||||
|
||||
struct Maximum {
|
||||
std::optional<std::string> description;
|
||||
std::variant<double, int> maximum;
|
||||
std::string type;
|
||||
std::variant<double, int> maximum;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct Minimum {
|
||||
std::optional<std::string> description;
|
||||
std::variant<double, int> minimum;
|
||||
std::string type;
|
||||
std::variant<double, int> minimum;
|
||||
std::string type;
|
||||
};
|
||||
|
||||
struct Null {
|
||||
Literal<"null"> type;
|
||||
Literal<"null"> type;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct Object {
|
||||
Literal<"object"> type;
|
||||
std::optional<std::string> description;
|
||||
Literal<"object"> type;
|
||||
std::optional<std::string> description;
|
||||
std::map<std::string, Type> properties;
|
||||
std::vector<std::string> required;
|
||||
std::vector<std::string> required;
|
||||
};
|
||||
|
||||
struct OneOf {
|
||||
std::optional<std::string> description;
|
||||
std::vector<Type> oneOf;
|
||||
std::vector<Type> oneOf;
|
||||
};
|
||||
|
||||
struct Reference {
|
||||
Rename<"$ref", std::optional<std::string>> ref;
|
||||
std::optional<std::string> description;
|
||||
std::optional<std::string> description;
|
||||
};
|
||||
|
||||
struct Regex {
|
||||
Literal<"string"> type;
|
||||
Literal<"string"> type;
|
||||
std::optional<std::string> description;
|
||||
std::string pattern;
|
||||
std::string pattern;
|
||||
};
|
||||
|
||||
struct StringEnum {
|
||||
Literal<"string"> type;
|
||||
std::optional<std::string> description;
|
||||
Literal<"string"> type;
|
||||
std::optional<std::string> description;
|
||||
rfl::Rename<"enum", std::vector<std::string>> values;
|
||||
};
|
||||
|
||||
struct StringMap {
|
||||
Literal<"object"> type;
|
||||
Literal<"object"> type;
|
||||
std::optional<std::string> description;
|
||||
rfl::Ref<Type> additionalProperties;
|
||||
rfl::Ref<Type> additionalProperties;
|
||||
};
|
||||
|
||||
struct Tuple {
|
||||
Literal<"array"> type;
|
||||
Literal<"array"> type;
|
||||
std::optional<std::string> description;
|
||||
std::vector<Type> prefixItems;
|
||||
bool items = false;
|
||||
std::vector<Type> prefixItems;
|
||||
bool items = false;
|
||||
};
|
||||
|
||||
struct TypedArray {
|
||||
Literal<"array"> type;
|
||||
Literal<"array"> type;
|
||||
std::optional<std::string> description;
|
||||
rfl::Ref<Type> items;
|
||||
rfl::Ref<Type> items;
|
||||
};
|
||||
|
||||
using ReflectionType = std::variant<AllOf,
|
||||
AnyOf,
|
||||
Boolean,
|
||||
ExclusiveMaximum,
|
||||
ExclusiveMinimum,
|
||||
FixedSizeTypedArray,
|
||||
Integer,
|
||||
Maximum,
|
||||
Minimum,
|
||||
Number,
|
||||
Null,
|
||||
Object,
|
||||
OneOf,
|
||||
Reference,
|
||||
Regex,
|
||||
String,
|
||||
StringEnum,
|
||||
StringMap,
|
||||
Tuple,
|
||||
TypedArray>;
|
||||
using ReflectionType = std::variant<
|
||||
AllOf,
|
||||
AnyOf,
|
||||
Boolean,
|
||||
ExclusiveMaximum,
|
||||
ExclusiveMinimum,
|
||||
FixedSizeTypedArray,
|
||||
Integer,
|
||||
Maximum,
|
||||
Minimum,
|
||||
Number,
|
||||
Null,
|
||||
Object,
|
||||
OneOf,
|
||||
Reference,
|
||||
Regex,
|
||||
String,
|
||||
StringEnum,
|
||||
StringMap,
|
||||
Tuple,
|
||||
TypedArray>;
|
||||
|
||||
const auto& reflection() const { return value; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue