@@ -41,7 +41,7 @@ describe('Schema Object', () => {
4141 ) ;
4242 } ) ;
4343
44- it ( 'returns a data structure representing all types for no type limitations' , ( ) => {
44+ it ( 'returns a data structure representing all types excluding null for no type limitations on OpenAPI less than 3.1 ' , ( ) => {
4545 const schema = new namespace . elements . Object ( { } ) ;
4646 const parseResult = parse ( context , schema ) ;
4747
@@ -58,6 +58,28 @@ describe('Schema Object', () => {
5858 expect ( element . enumerations . get ( 2 ) ) . to . be . instanceof ( namespace . elements . Boolean ) ;
5959 expect ( element . enumerations . get ( 3 ) ) . to . be . instanceof ( namespace . elements . Object ) ;
6060 expect ( element . enumerations . get ( 4 ) ) . to . be . instanceof ( namespace . elements . Array ) ;
61+ expect ( element . attributes . getValue ( 'typeAttributes' ) ) . to . be . undefined ;
62+ } ) ;
63+
64+ it ( 'returns a data structure representing all types for no type limitations on OpenAPI 3.1' , ( ) => {
65+ context . openapiVersion = { major : 3 , minor : 1 } ;
66+ const schema = new namespace . elements . Object ( { } ) ;
67+ const parseResult = parse ( context , schema ) ;
68+
69+ expect ( parseResult . length ) . to . equal ( 1 ) ;
70+ expect ( parseResult . get ( 0 ) ) . to . be . instanceof ( namespace . elements . DataStructure ) ;
71+ expect ( parseResult ) . to . not . contain . annotations ;
72+
73+ const element = parseResult . get ( 0 ) . content ;
74+ expect ( element ) . to . be . instanceof ( namespace . elements . Enum ) ;
75+
76+ expect ( element . enumerations . length ) . to . equal ( 5 ) ;
77+ expect ( element . enumerations . get ( 0 ) ) . to . be . instanceof ( namespace . elements . String ) ;
78+ expect ( element . enumerations . get ( 1 ) ) . to . be . instanceof ( namespace . elements . Number ) ;
79+ expect ( element . enumerations . get ( 2 ) ) . to . be . instanceof ( namespace . elements . Boolean ) ;
80+ expect ( element . enumerations . get ( 3 ) ) . to . be . instanceof ( namespace . elements . Object ) ;
81+ expect ( element . enumerations . get ( 4 ) ) . to . be . instanceof ( namespace . elements . Array ) ;
82+ expect ( element . attributes . getValue ( 'typeAttributes' ) ) . to . deep . equal ( [ 'nullable' ] ) ;
6183 } ) ;
6284
6385 it ( 'returns a boolean structure for boolean type' , ( ) => {
@@ -577,6 +599,7 @@ describe('Schema Object', () => {
577599
578600 it ( 'adds nullable type attribute to element' , ( ) => {
579601 const schema = new namespace . elements . Object ( {
602+ type : 'array' ,
580603 nullable : true ,
581604 } ) ;
582605 const parseResult = parse ( context , schema ) ;
0 commit comments