Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions include/rfl/generic/Writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,12 @@
#define GENERIC_WRITER_HPP_

#include <cstddef>
#include <exception>
#include <functional>
#include <map>
#include <optional>
#include <sstream>
#include <stdexcept>
#include <string>
#include <string_view>
#include <type_traits>
#include <vector>

#include "../Generic.hpp"
#include "../Result.hpp"
#include "../Variant.hpp"
#include "../always_false.hpp"

namespace rfl::generic {
Expand Down
5 changes: 0 additions & 5 deletions include/rfl/generic/write.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#ifndef GENERIC_WRITE_HPP_
#define GENERIC_WRITE_HPP_

#include <cstddef>
#include <ostream>
#include <sstream>
#include <vector>

#include "../Generic.hpp"
#include "../parsing/Parent.hpp"
#include "Parser.hpp"
Expand Down
7 changes: 3 additions & 4 deletions include/rfl/json/schema/JSONSchema.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <map>
#include <string>
#include <variant>

#include "../../Flatten.hpp"
#include "../../Literal.hpp"
Expand All @@ -15,9 +14,9 @@ namespace rfl::json::schema {
template <class T>
struct JSONSchema {
Rename<"$schema", Literal<"https://json-schema.org/draft/2020-12/schema">>
schema;
Flatten<T> root;
std::map<std::string, Type> definitions;
schema{};
Flatten<T> root{};
std::map<std::string, Type> definitions{};
};

} // namespace rfl::json::schema
Expand Down
119 changes: 59 additions & 60 deletions include/rfl/json/schema/Type.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef RFL_JSON_SCHEMA_TYPE_HPP_
#define RFL_JSON_SCHEMA_TYPE_HPP_

#include <map>
#include <memory>
#include <optional>
#include <string>
Expand All @@ -16,125 +15,125 @@ namespace rfl::json::schema {
/// The JSON representation of internal::schema::Type.
struct Type {
struct Boolean {
std::optional<std::string> description;
Literal<"boolean"> type;
std::optional<std::string> description{};
Literal<"boolean"> type{};
};

struct Integer {
Literal<"integer"> type;
std::optional<std::string> description;
Literal<"integer"> type{};
std::optional<std::string> description{};
};

struct Number {
Literal<"number"> type;
std::optional<std::string> description;
Literal<"number"> type{};
std::optional<std::string> description{};
};

struct String {
Literal<"string"> type;
std::optional<std::string> description;
rfl::Rename<"minLength", std::optional<size_t>> minSize;
rfl::Rename<"maxLength", std::optional<size_t>> maxSize;
Literal<"string"> type{};
std::optional<std::string> description{};
rfl::Rename<"minLength", std::optional<size_t>> minSize{};
rfl::Rename<"maxLength", std::optional<size_t>> maxSize{};
};

using NumericType = rfl::Variant<Integer, Number>;

struct AllOf {
std::optional<std::string> description;
std::vector<Type> allOf;
std::optional<std::string> description{};
std::vector<Type> allOf{};
};

struct AnyOf {
std::optional<std::string> description;
std::vector<Type> anyOf;
std::optional<std::string> description{};
std::vector<Type> anyOf{};
};

struct ExclusiveMaximum {
std::optional<std::string> description;
rfl::Variant<double, int> exclusiveMaximum;
std::string type;
std::optional<std::string> description{};
rfl::Variant<double, int> exclusiveMaximum{};
std::string type{};
};

struct ExclusiveMinimum {
std::optional<std::string> description;
rfl::Variant<double, int> exclusiveMinimum;
std::string type;
std::optional<std::string> description{};
rfl::Variant<double, int> exclusiveMinimum{};
std::string type{};
};

struct FixedSizeTypedArray {
Literal<"array"> type;
std::optional<std::string> description;
rfl::Ref<Type> items;
size_t minItems;
size_t maxItems;
Literal<"array"> type{};
std::optional<std::string> description{};
rfl::Ref<Type> items{};
size_t minItems{};
size_t maxItems{};
};

struct Maximum {
std::optional<std::string> description;
rfl::Variant<double, int> maximum;
std::string type;
std::optional<std::string> description{};
rfl::Variant<double, int> maximum{};
std::string type{};
};

struct Minimum {
std::optional<std::string> description;
rfl::Variant<double, int> minimum;
std::string type;
std::optional<std::string> description{};
rfl::Variant<double, int> minimum{};
std::string type{};
};

struct Null {
Literal<"null"> type;
std::optional<std::string> description;
Literal<"null"> type{};
std::optional<std::string> description{};
};

struct Object {
Literal<"object"> type;
std::optional<std::string> description;
rfl::Object<Type> properties;
std::vector<std::string> required;
std::shared_ptr<Type> additionalProperties;
Literal<"object"> type{};
std::optional<std::string> description{};
rfl::Object<Type> properties{};
std::vector<std::string> required{};
std::shared_ptr<Type> additionalProperties{};
};

struct OneOf {
std::optional<std::string> description;
std::vector<Type> oneOf;
std::optional<std::string> description{};
std::vector<Type> oneOf{};
};

struct Reference {
Rename<"$ref", std::optional<std::string>> ref;
std::optional<std::string> description;
Rename<"$ref", std::optional<std::string>> ref{};
std::optional<std::string> description{};
};

struct Regex {
Literal<"string"> type;
std::optional<std::string> description;
std::string pattern;
Literal<"string"> type{};
std::optional<std::string> description{};
std::string pattern{};
};

struct StringEnum {
Literal<"string"> type;
std::optional<std::string> description;
rfl::Rename<"enum", std::vector<std::string>> values;
Literal<"string"> type{};
std::optional<std::string> description{};
rfl::Rename<"enum", std::vector<std::string>> values{};
};

struct StringMap {
Literal<"object"> type;
std::optional<std::string> description;
rfl::Ref<Type> additionalProperties;
Literal<"object"> type{};
std::optional<std::string> description{};
rfl::Ref<Type> additionalProperties{};
};

struct Tuple {
Literal<"array"> type;
std::optional<std::string> description;
std::vector<Type> prefixItems;
Literal<"array"> type{};
std::optional<std::string> description{};
std::vector<Type> prefixItems{};
bool items = false;
};

struct TypedArray {
Literal<"array"> type;
std::optional<std::string> description;
rfl::Ref<Type> items;
rfl::Rename<"minItems", std::optional<size_t>> minSize;
rfl::Rename<"maxItems", std::optional<size_t>> maxSize;
Literal<"array"> type{};
std::optional<std::string> description{};
rfl::Ref<Type> items{};
rfl::Rename<"minItems", std::optional<size_t>> minSize{};
rfl::Rename<"maxItems", std::optional<size_t>> maxSize{};
};

using ReflectionType =
Expand Down
Loading