11package io .quarkiverse .chappie .runtime .dev ;
22
3+ import static com .github .victools .jsonschema .module .jackson .JacksonOption .RESPECT_JSONPROPERTY_REQUIRED ;
4+
35import java .lang .reflect .Type ;
46import java .nio .file .Path ;
57import java .util .List ;
@@ -128,7 +130,7 @@ public static String toJsonString(Map<String, Object> data) {
128130 * TODO: We can cache this
129131 */
130132 private static String buildResponsePrompt (Type answerType ) {
131- JsonNode jsonSchema = SCHEMA_GENERATOR .generateSchema (answerType );
133+ JsonNode jsonSchema = SCHEMA_GENERATOR .generateSchema (ChappieEnvelope . class , answerType );
132134
133135 return """
134136 RESPONSE FORMAT (strict):
@@ -137,16 +139,18 @@ RESPONSE FORMAT (strict):
137139 - Only use the contents in the [USER PROMPT]
138140 - Constraints: ≤ 60 chars, 4–9 words, Title Case, no quotes/backticks, no trailing punctuation.
139141 - Make it specific (action + topic), e.g., "Fix WebSocket Reconnect in Quarkus".
140- - "answer": Must match and validates against the following JSON Schema (Draft 2020-12). Do not include extra fields.
141- - JSON Scheme:
142- %s
142+ - "answer": answer to the user request
143+
144+ The response must match and validate against the following JSON Schema (Draft 2020-12). Do not include extra fields.
145+ - JSON Schema:
146+ %s
143147 """
144148 .formatted (jsonSchema .toString ());
145149 }
146150
147151 private static final SchemaGenerator SCHEMA_GENERATOR = new SchemaGenerator (
148152 new SchemaGeneratorConfigBuilder (SchemaVersion .DRAFT_2020_12 )
149- .with (new JacksonModule ())
153+ .with (new JacksonModule (RESPECT_JSONPROPERTY_REQUIRED ))
150154 .without (Option .FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS )
151155 .without (Option .GETTER_METHODS )
152156 .without (Option .NONSTATIC_NONVOID_NONGETTER_METHODS )
0 commit comments