buildJsonSchema
Generates a JSON Schema representation from a Kotlinx Serialization SerialDescriptor.
Supports the following descriptor kinds:
CLASS/OBJECT: Maps to object schema with properties and required fields (based on nullability)
LIST: Maps to array schema with items
MAP: Maps to object schema with additionalProperties
Primitives (STRING, BOOLEAN, INT, LONG, FLOAT, DOUBLE, etc.): Maps to corresponding JSON types
ENUM: Maps to string schema with enum values
CONTEXTUAL: Returns a generic object schema (actual type resolution requires serialization context)
Return
A JsonSchema object representing the JSON Schema for this descriptor.
Note: This function does not handle circular references. For types with circular dependencies, consider implementing depth tracking or schema references to avoid stack overflow.