public Optional<String> maybeVisit(JsonNode schema, String baseName, String name) {
            var typeText = getTypeText(schema);

            if ((typeText == null || typeText.equals("integer"))
                    && (schema.has("minimum") || schema.has("exclusiveMinimum")
                    || schema.has("maximum") || schema.has("exclusiveMaximum"))) {

                Integer minValue = null;
                Integer maxValue = null;

                if (schema.has("minimum")) {
                    minValue = schema.get("minimum").asInt();
                } else if (schema.has("exclusiveMinimum")) {
                    minValue = schema.get("exclusiveMinimum").asInt() + 1;
                }

                if (schema.has("maximum")) {
                    maxValue = schema.get("maximum").asInt();
                } else if (schema.has("exclusiveMaximum")) {
                    maxValue = schema.get("exclusiveMaximum").asInt() - 1;
                }

                var content = "(" + generateMinMaxInt(minValue, maxValue, 16, true) + ") space";
                var rule = addRule(name, content);
                return Optional.of(rule);
            }

            return Optional.empty();
        }
Converts a JSON Schema to a GBNF grammar to be used for structured output with llama.cpp.
It is a port of Python implementation from llama.cpp repository.
Current implementation doesn't support regex patterns, resolving $ref or fetching schemas from URLs.
The plan is to replace this with C++ implementation from llama.cpp though JNI.
model-integration/src/main/java/ai/vespa/llm/clients/JsonSchemaToGrammar.java