Class JsonSchemaElementUtils
java.lang.Object
dev.langchain4j.internal.JsonSchemaElementUtils
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic JsonSchemaElementjsonObjectOrReferenceSchemaFrom(Class<?> type, String description, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited, boolean setDefinitions) static JsonSchemaElementjsonSchemaElementFrom(Class<?> clazz) static JsonSchemaElementjsonSchemaElementFrom(Class<?> clazz, Type type, String fieldDescription, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) static JsonSchemaElementpolymorphicSchemaFrom(Class<?> baseType, String description, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) static JsonSchemaElementreferenceIfRecursive(JsonSchemaElement element, Class<?> baseType, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) If recursion was detected forbaseType, returns aJsonReferenceSchemato the polymorphic body (which will be emitted under$defs); otherwise returnselementunchanged.toMap(JsonSchemaElement jsonSchemaElement) toMap(JsonSchemaElement jsonSchemaElement, boolean strict) toMap(JsonSchemaElement jsonSchemaElement, boolean strict, boolean required) toMap(JsonSchemaElement jsonSchemaElement, boolean strict, boolean required, String enumType) toMap(Map<String, JsonSchemaElement> properties) toMap(Map<String, JsonSchemaElement> properties, boolean strict) static JsonObjectSchemawrapPolymorphic(String propertyName, JsonSchemaElement element, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) Wrapselementas the only required property of an object schema (thevalue/valuesenvelope used at the root of polymorphic AI Service return types, sinceanyOfis not allowed at the JSON-schema root) and attaches any recursion-induced definitions collected invisited.
-
Constructor Details
-
JsonSchemaElementUtils
public JsonSchemaElementUtils()
-
-
Method Details
-
jsonSchemaElementFrom
-
jsonSchemaElementFrom
public static JsonSchemaElement jsonSchemaElementFrom(Class<?> clazz, Type type, String fieldDescription, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) -
polymorphicSchemaFrom
public static JsonSchemaElement polymorphicSchemaFrom(Class<?> baseType, String description, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) -
referenceIfRecursive
public static JsonSchemaElement referenceIfRecursive(JsonSchemaElement element, Class<?> baseType, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) If recursion was detected forbaseType, returns aJsonReferenceSchemato the polymorphic body (which will be emitted under$defs); otherwise returnselementunchanged. Avoids duplicating the body inline next to the$defsentry. -
wrapPolymorphic
public static JsonObjectSchema wrapPolymorphic(String propertyName, JsonSchemaElement element, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited) Wrapselementas the only required property of an object schema (thevalue/valuesenvelope used at the root of polymorphic AI Service return types, sinceanyOfis not allowed at the JSON-schema root) and attaches any recursion-induced definitions collected invisited. -
jsonObjectOrReferenceSchemaFrom
public static JsonSchemaElement jsonObjectOrReferenceSchemaFrom(Class<?> type, String description, boolean areSubFieldsRequiredByDefault, Map<Class<?>, JsonSchemaElementUtils.VisitedClassMetadata> visited, boolean setDefinitions) -
toMap
-
toMap
-
toMap
-
toMap
-
toMap
public static Map<String,Object> toMap(JsonSchemaElement jsonSchemaElement, boolean strict, boolean required) -
toMap
public static Map<String,Object> toMap(JsonSchemaElement jsonSchemaElement, boolean strict, boolean required, String enumType)
-