mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 10:46:18 +08:00
@@ -88,6 +88,7 @@ struct Type {
|
||||
std::optional<std::string> description;
|
||||
std::map<std::string, Type> properties;
|
||||
std::vector<std::string> required;
|
||||
std::shared_ptr<Type> additionalProperties;
|
||||
};
|
||||
|
||||
struct OneOf {
|
||||
|
||||
@@ -193,8 +193,15 @@ inline schema::Type type_to_json_schema_type(
|
||||
required.push_back(k);
|
||||
}
|
||||
}
|
||||
auto additional_properties =
|
||||
_t.additional_properties_
|
||||
? std::make_shared<schema::Type>(
|
||||
type_to_json_schema_type(*_t.additional_properties_))
|
||||
: std::shared_ptr<schema::Type>();
|
||||
return schema::Type{.value = schema::Type::Object{
|
||||
.properties = properties, .required = required}};
|
||||
.properties = properties,
|
||||
.required = required,
|
||||
.additionalProperties = additional_properties}};
|
||||
|
||||
} else if constexpr (std::is_same<T, Type::Optional>()) {
|
||||
return schema::Type{.value = schema::Type::AnyOf{
|
||||
|
||||
Reference in New Issue
Block a user