@@ -22,9 +22,10 @@ def test_misuse
2222  E1  =  OpenAI ::Helpers ::StructuredOutput ::EnumOf [ :one ] 
2323
2424  class  M1  < OpenAI ::Helpers ::StructuredOutput ::BaseModel 
25-     required  :a ,  String 
25+     required  :a ,  String ,   doc :  "dog" 
2626    required  :b ,  Integer ,  nil? : true 
27-     required  :c ,  E1 ,  nil? : true 
27+     required  :c ,  E1 ,  nil? : true ,  doc : "dog" 
28+     required  :d ,  E1 ,  doc : "dog" 
2829  end 
2930
3031  class  M2  < OpenAI ::Helpers ::StructuredOutput ::BaseModel 
@@ -36,7 +37,7 @@ class M3 < OpenAI::Helpers::StructuredOutput::BaseModel
3637  end 
3738
3839  U1  =  OpenAI ::Helpers ::StructuredOutput ::UnionOf [ Integer ,  A1 ] 
39-   U2  =  OpenAI ::Helpers ::StructuredOutput ::UnionOf [ :type ,   m2 :  M2 ,   m3 :  M3 ] 
40+   U2  =  OpenAI ::Helpers ::StructuredOutput ::UnionOf [ M2 ,  M3 ] 
4041  U3  =  OpenAI ::Helpers ::StructuredOutput ::UnionOf [ A1 ,  A1 ] 
4142
4243  def  test_coerce 
@@ -78,18 +79,21 @@ def test_to_schema
7879      A1  =>  { type : "array" ,  items : { type : "string" } } , 
7980      OpenAI ::Helpers ::StructuredOutput ::ArrayOf [ String ,  nil? : true ,  doc : "a1" ]  =>  { 
8081        type : "array" , 
81-         items : { type : %w[ string  null ] } , 
82-         description : "a1" 
82+         items : { type : %w[ string  null ] ,  description : "a1" } 
8383      } , 
8484      E1  =>  { type : "string" ,  enum : [ "one" ] } , 
8585      M1  =>  { 
8686        type : "object" , 
8787        properties : { 
88-           a : { type : "string" } , 
88+           a : { type : "string" ,   description :  "dog" } , 
8989          b : { type : %w[ integer  null ] } , 
90-           c : { anyOf : [ { type : "string" ,  enum : %w[ one ] } ,  { type : "null" } ] } 
90+           c : { 
91+             anyOf : [ { type : "string" ,  enum : [ "one" ] } ,  { type : "null" } ] , 
92+             description : "dog" 
93+           } , 
94+           d : { description : "dog" ,  type : "string" ,  enum : [ "one" ] } 
9195        } , 
92-         required : %w[ a  b  c ] , 
96+         required : %w[ a  b  c   d ] , 
9397        additionalProperties : false 
9498      } , 
9599      U1  =>  { 
@@ -162,8 +166,9 @@ class M10 < OpenAI::Helpers::StructuredOutput::BaseModel
162166
163167  class  M11  < OpenAI ::Helpers ::StructuredOutput ::BaseModel 
164168    required  :a ,  U3 
165-     required  :b ,  A1 
169+     required  :b ,  A1 ,   doc :  "dog" 
166170    required  :c ,  A1 
171+     required  :d ,  A1 ,  doc : "dawg" 
167172  end 
168173
169174  def  test_definition_reusing 
@@ -311,20 +316,20 @@ def test_definition_reusing
311316        ] 
312317      } , 
313318      M11  =>  { 
314-         :$defs  =>  { ".a/?.0/[]"  =>  { type : "array" ,  items : { type : "string" } } } , 
315-         :type  =>  "object" , 
316-         :properties  =>  { 
319+         type : "object" , 
320+         properties : { 
317321          a : { 
318322            anyOf : [ 
319323              { type : "array" ,  items : { type : "string" } } , 
320324              { type : "array" ,  items : { type : "string" } } 
321325            ] 
322326          } , 
323-           b : { :$ref  =>  "#/$defs/.a/?.0/[]" } , 
324-           c : { :$ref  =>  "#/$defs/.a/?.0/[]" } 
327+           b : { description : "dog" ,  type : "array" ,  items : { type : "string" } } , 
328+           c : { type : "array" ,  items : { type : "string" } } , 
329+           d : { description : "dawg" ,  type : "array" ,  items : { type : "string" } } 
325330        } , 
326-         : required  =>   %w[ a  b  c ] , 
327-         : additionalProperties  =>  false 
331+         required :  %w[ a  b  c   d ] , 
332+         additionalProperties :  false 
328333      } 
329334    } 
330335
0 commit comments