DTO_FIELD_INFO(referral) {
info->pattern = "^[^\\s]+$"; // This is what we set to add
};
DTO_FIELD(String, referral, "referral") = "direct";
DTO_FIELD(List<String>, friends) = [](){
auto defaultFriends = List<String>::createShared();
defaultFriends->push_back(String("me")); // :)
return defaultFriends;
}(); // Poor-mans default, just for testing
DTO_FIELD(Enum<HelloEnum>, helloEnum) = HelloEnum::V1; // We had it but it wasn't showing in swagger
"referral": {
"type": "string",
"default": "direct",
"pattern": "^[^\\s]+$" // <- Some tools can use this for validating the JSON
},
"friends": {
"type": "array",
"default": [ // <- Defaults for List<String>
"me"
],
"items": {
"type": "string"
}
},
"helloEnum": {
"default": "value-1", // <- Defaults for Enum<T>
"$ref": "#\/components\/schemas\/HelloEnum(String)"
}