@Test
    public void testObjectWithOptionalProperties() {
        var schema = """
                {
                    "properties": {
                        "a": {"type": "string"}
                    },
                    "additionalProperties": false
                }
                """;
        var expectedGrammar = """
                a-kv ::= "\\"a\\"" space ":" space string
                char ::= [^"\\\\\\x7F\\x00-\\x1F] | [\\\\] (["\\\\bfnrt] | "u" [0-9a-fA-F]{4})
                root ::= "{" space  (a-kv )? "}" space
                space ::= | " " | "\\n" [ \\t]{0,20}
                string ::= "\\"" char* "\\"" space
                """;

        var actualGrammar = JsonSchemaToGrammar.convert(schema);
        assertEquals(expectedGrammar, actualGrammar);
    }
These tests are based on C++ unit tests from llama.cpp repository.
model-integration/src/test/java/ai/vespa/llm/clients/JsonSchemaToGrammarTest.java