We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ccce9c commit f564a14Copy full SHA for f564a14
README.md
@@ -291,6 +291,28 @@ class MySchema < RubyLLM::Schema
291
end
292
```
293
294
+### Nested Schemas
295
+
296
+You can embed existing schema classes directly within objects or arrays for reusable schema composition.
297
298
+```ruby
299
+class PersonSchema < RubyLLM::Schema
300
+ string :name
301
+ integer :age
302
+end
303
304
+class CompanySchema < RubyLLM::Schema
305
+ # Using 'of' parameter
306
+ object :ceo, of: PersonSchema
307
+ array :employees, of: PersonSchema
308
309
+ # Using Schema.new in block
310
+ object :founder do
311
+ PersonSchema.new
312
+ end
313
314
+```
315
316
## JSON Output
317
318
```ruby
0 commit comments