mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-03 16:56:17 +08:00
clang 20 warnings (#514)
This commit is contained in:
@@ -2,20 +2,12 @@
|
|||||||
#define GENERIC_WRITER_HPP_
|
#define GENERIC_WRITER_HPP_
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <exception>
|
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
|
||||||
#include <optional>
|
|
||||||
#include <sstream>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "../Generic.hpp"
|
#include "../Generic.hpp"
|
||||||
#include "../Result.hpp"
|
|
||||||
#include "../Variant.hpp"
|
|
||||||
#include "../always_false.hpp"
|
#include "../always_false.hpp"
|
||||||
|
|
||||||
namespace rfl::generic {
|
namespace rfl::generic {
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
#ifndef GENERIC_WRITE_HPP_
|
#ifndef GENERIC_WRITE_HPP_
|
||||||
#define GENERIC_WRITE_HPP_
|
#define GENERIC_WRITE_HPP_
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "../Generic.hpp"
|
#include "../Generic.hpp"
|
||||||
#include "../parsing/Parent.hpp"
|
#include "../parsing/Parent.hpp"
|
||||||
#include "Parser.hpp"
|
#include "Parser.hpp"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
#include "../../Flatten.hpp"
|
#include "../../Flatten.hpp"
|
||||||
#include "../../Literal.hpp"
|
#include "../../Literal.hpp"
|
||||||
@@ -15,9 +14,9 @@ namespace rfl::json::schema {
|
|||||||
template <class T>
|
template <class T>
|
||||||
struct JSONSchema {
|
struct JSONSchema {
|
||||||
Rename<"$schema", Literal<"https://json-schema.org/draft/2020-12/schema">>
|
Rename<"$schema", Literal<"https://json-schema.org/draft/2020-12/schema">>
|
||||||
schema;
|
schema{};
|
||||||
Flatten<T> root;
|
Flatten<T> root{};
|
||||||
std::map<std::string, Type> definitions;
|
std::map<std::string, Type> definitions{};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rfl::json::schema
|
} // namespace rfl::json::schema
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#ifndef RFL_JSON_SCHEMA_TYPE_HPP_
|
#ifndef RFL_JSON_SCHEMA_TYPE_HPP_
|
||||||
#define RFL_JSON_SCHEMA_TYPE_HPP_
|
#define RFL_JSON_SCHEMA_TYPE_HPP_
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -16,125 +15,125 @@ namespace rfl::json::schema {
|
|||||||
/// The JSON representation of internal::schema::Type.
|
/// The JSON representation of internal::schema::Type.
|
||||||
struct Type {
|
struct Type {
|
||||||
struct Boolean {
|
struct Boolean {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
Literal<"boolean"> type;
|
Literal<"boolean"> type{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Integer {
|
struct Integer {
|
||||||
Literal<"integer"> type;
|
Literal<"integer"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Number {
|
struct Number {
|
||||||
Literal<"number"> type;
|
Literal<"number"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct String {
|
struct String {
|
||||||
Literal<"string"> type;
|
Literal<"string"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Rename<"minLength", std::optional<size_t>> minSize;
|
rfl::Rename<"minLength", std::optional<size_t>> minSize{};
|
||||||
rfl::Rename<"maxLength", std::optional<size_t>> maxSize;
|
rfl::Rename<"maxLength", std::optional<size_t>> maxSize{};
|
||||||
};
|
};
|
||||||
|
|
||||||
using NumericType = rfl::Variant<Integer, Number>;
|
using NumericType = rfl::Variant<Integer, Number>;
|
||||||
|
|
||||||
struct AllOf {
|
struct AllOf {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
std::vector<Type> allOf;
|
std::vector<Type> allOf{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AnyOf {
|
struct AnyOf {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
std::vector<Type> anyOf;
|
std::vector<Type> anyOf{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExclusiveMaximum {
|
struct ExclusiveMaximum {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Variant<double, int> exclusiveMaximum;
|
rfl::Variant<double, int> exclusiveMaximum{};
|
||||||
std::string type;
|
std::string type{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ExclusiveMinimum {
|
struct ExclusiveMinimum {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Variant<double, int> exclusiveMinimum;
|
rfl::Variant<double, int> exclusiveMinimum{};
|
||||||
std::string type;
|
std::string type{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FixedSizeTypedArray {
|
struct FixedSizeTypedArray {
|
||||||
Literal<"array"> type;
|
Literal<"array"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Ref<Type> items;
|
rfl::Ref<Type> items{};
|
||||||
size_t minItems;
|
size_t minItems{};
|
||||||
size_t maxItems;
|
size_t maxItems{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Maximum {
|
struct Maximum {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Variant<double, int> maximum;
|
rfl::Variant<double, int> maximum{};
|
||||||
std::string type;
|
std::string type{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Minimum {
|
struct Minimum {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Variant<double, int> minimum;
|
rfl::Variant<double, int> minimum{};
|
||||||
std::string type;
|
std::string type{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Null {
|
struct Null {
|
||||||
Literal<"null"> type;
|
Literal<"null"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Object {
|
struct Object {
|
||||||
Literal<"object"> type;
|
Literal<"object"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Object<Type> properties;
|
rfl::Object<Type> properties{};
|
||||||
std::vector<std::string> required;
|
std::vector<std::string> required{};
|
||||||
std::shared_ptr<Type> additionalProperties;
|
std::shared_ptr<Type> additionalProperties{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OneOf {
|
struct OneOf {
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
std::vector<Type> oneOf;
|
std::vector<Type> oneOf{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Reference {
|
struct Reference {
|
||||||
Rename<"$ref", std::optional<std::string>> ref;
|
Rename<"$ref", std::optional<std::string>> ref{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Regex {
|
struct Regex {
|
||||||
Literal<"string"> type;
|
Literal<"string"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
std::string pattern;
|
std::string pattern{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StringEnum {
|
struct StringEnum {
|
||||||
Literal<"string"> type;
|
Literal<"string"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Rename<"enum", std::vector<std::string>> values;
|
rfl::Rename<"enum", std::vector<std::string>> values{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StringMap {
|
struct StringMap {
|
||||||
Literal<"object"> type;
|
Literal<"object"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Ref<Type> additionalProperties;
|
rfl::Ref<Type> additionalProperties{};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tuple {
|
struct Tuple {
|
||||||
Literal<"array"> type;
|
Literal<"array"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
std::vector<Type> prefixItems;
|
std::vector<Type> prefixItems{};
|
||||||
bool items = false;
|
bool items = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TypedArray {
|
struct TypedArray {
|
||||||
Literal<"array"> type;
|
Literal<"array"> type{};
|
||||||
std::optional<std::string> description;
|
std::optional<std::string> description{};
|
||||||
rfl::Ref<Type> items;
|
rfl::Ref<Type> items{};
|
||||||
rfl::Rename<"minItems", std::optional<size_t>> minSize;
|
rfl::Rename<"minItems", std::optional<size_t>> minSize{};
|
||||||
rfl::Rename<"maxItems", std::optional<size_t>> maxSize;
|
rfl::Rename<"maxItems", std::optional<size_t>> maxSize{};
|
||||||
};
|
};
|
||||||
|
|
||||||
using ReflectionType =
|
using ReflectionType =
|
||||||
|
|||||||
Reference in New Issue
Block a user