common/json-schema : fix GBNF grammar generation for empty object schemas (#28279)

This commit is contained in:
Sergey Sklyarov
2026-09-03 15:37:50 -05:00
committed by GitHub
parent 95ef7fc160
commit c5a5535e6e
3 changed files with 8 additions and 1 deletions
+4
View File
@@ -748,6 +748,10 @@ private:
optional_props.push_back("*");
}
if (required_props.empty() && optional_props.empty()) {
return "\"{\" space \"}\"";
}
std::string rule = "\"{\" space ";
for (size_t i = 0; i < required_props.size(); i++) {
if (i > 0) {