mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-11-27 05:16:18 +08:00
clang 20 warnings (#514)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "../../Flatten.hpp"
|
||||
#include "../../Literal.hpp"
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#ifndef RFL_JSON_SCHEMA_TYPE_HPP_
|
||||
#define RFL_JSON_SCHEMA_TYPE_HPP_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user