From d69ccb06a41db257e55fa47e4e17e33d64019800 Mon Sep 17 00:00:00 2001 From: ochafik Date: Tue, 30 Apr 2024 23:35:33 +0100 Subject: [PATCH] json: fix min 0 --- common/json-schema-to-grammar.cpp | 1 + tests/test-json-schema-to-grammar.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/common/json-schema-to-grammar.cpp b/common/json-schema-to-grammar.cpp index 35d261d19..294370aa0 100644 --- a/common/json-schema-to-grammar.cpp +++ b/common/json-schema-to-grammar.cpp @@ -195,6 +195,7 @@ static void _generate_min_max_int(int min_value, int max_value, std::stringstrea if (min_value == 0) { if (top_level) { out << "[1-9] "; + out << "[0] | [1-9] "; more_digits(0, less_decimals); } else { more_digits(1, decimals_left); diff --git a/tests/test-json-schema-to-grammar.cpp b/tests/test-json-schema-to-grammar.cpp index e001ef9fb..0fcf25b95 100755 --- a/tests/test-json-schema-to-grammar.cpp +++ b/tests/test-json-schema-to-grammar.cpp @@ -88,7 +88,7 @@ static void test_all(const std::string & lang, std::function