Module: Dry::Schema::JSONSchema::SchemaMethods
- Defined in:
- lib/dspy/ext/dry_schema.rb
Instance Method Summary collapse
-
#json_schema(loose: false) ⇒ Object
Override the original json_schema method.
Instance Method Details
#json_schema(loose: false) ⇒ Object
Override the original json_schema method
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/dspy/ext/dry_schema.rb', line 74 def json_schema(loose: false) compiler = SchemaCompiler.new(root: true, loose: loose) compiler.call(to_ast) result = compiler.to_hash # Add descriptions to properties from schema_metas if respond_to?(:schema_metas) && !.empty? .each do |key, | if [:description] && result[:properties][key] result[:properties][key][:description] = [:description] end end end result end |