Open guersam opened 1 month ago
Describe the bug JsonSchema.fromZSchema includes refs when refType = SchemaStyle.Inline.
JsonSchema.fromZSchema
refType = SchemaStyle.Inline
To Reproduce Steps to reproduce the behaviour:
scastie
Expected behaviour
All properties are inlined i.e. there are no $ref
$ref
Actual behavior
Nested object is still referenced by name
{ "type" : "object", "properties" : { "bar" : { "$ref" : "#/components/schemas/Bar" } }, "required" : [ "bar" ] }
Additional context
It's needed for structured output when using OpenAI.
I tried simply replacing the hardcoded refType arguments in JsonSchema.fromZSchema with the outer refType, but it causes another bug that flattens nested case classes in properties field.
refType
properties
Describe the bug
JsonSchema.fromZSchema
includes refs whenrefType = SchemaStyle.Inline
.To Reproduce Steps to reproduce the behaviour:
JsonSchema.fromZSchema
withrefType = SchemaStyle.Inline
scastie
Expected behaviour
All properties are inlined i.e. there are no
$ref
Actual behavior
Nested object is still referenced by name
Additional context
It's needed for structured output when using OpenAI.