@@ -97,7 +97,7 @@ describe("Schema Object", () => {
97
97
test ( "basic" , ( ) => {
98
98
const schema : SchemaObject = { type : "array" , items : { type : "string" } } ;
99
99
const generated = transformSchemaObject ( schema , options ) ;
100
- expect ( generated ) . toBe ( "( string) []" ) ;
100
+ expect ( generated ) . toBe ( "string[]" ) ;
101
101
} ) ;
102
102
103
103
test ( "tuple array" , ( ) => {
@@ -109,7 +109,7 @@ describe("Schema Object", () => {
109
109
test ( "ref" , ( ) => {
110
110
const schema : SchemaObject = { type : "array" , items : { $ref : 'components["schemas"]["ArrayItem"]' } } ;
111
111
const generated = transformSchemaObject ( schema , options ) ;
112
- expect ( generated ) . toBe ( '( components["schemas"]["ArrayItem"]) []' ) ;
112
+ expect ( generated ) . toBe ( 'components["schemas"]["ArrayItem"][]' ) ;
113
113
} ) ;
114
114
} ) ;
115
115
@@ -267,7 +267,7 @@ describe("Schema Object", () => {
267
267
268
268
test ( "array" , ( ) => {
269
269
const generated = transformSchemaObject ( { type : "array" , items : { type : "string" } , nullable : true } , options ) ;
270
- expect ( generated ) . toBe ( "( string) [] | null" ) ;
270
+ expect ( generated ) . toBe ( "string[] | null" ) ;
271
271
} ) ;
272
272
273
273
test ( "object" , ( ) => {
@@ -301,7 +301,7 @@ describe("Schema Object", () => {
301
301
302
302
test ( "array" , ( ) => {
303
303
const generated = transformSchemaObject ( { type : [ "array" , "null" ] , items : { type : "string" } } as any , options ) ;
304
- expect ( generated ) . toBe ( "( string) [] | null" ) ;
304
+ expect ( generated ) . toBe ( "string[] | null" ) ;
305
305
} ) ;
306
306
307
307
test ( "object" , ( ) => {
@@ -405,7 +405,7 @@ describe("Schema Object", () => {
405
405
} | {
406
406
number: number;
407
407
} | {
408
- array: ( string) [];
408
+ array: string[];
409
409
} | {
410
410
object: {
411
411
string: string;
@@ -606,10 +606,10 @@ describe("Schema Object", () => {
606
606
607
607
test ( "supportArrayLength" , ( ) => {
608
608
const opts = { ...options , ctx : { ...options . ctx , supportArrayLength : true } } ;
609
- expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } } , options ) ) . toBe ( `( string) []` ) ;
610
- expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } , minItems : 1 } , opts ) ) . toBe ( `[string, ...( string) []]` ) ;
609
+ expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } } , options ) ) . toBe ( `string[]` ) ;
610
+ expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } , minItems : 1 } , opts ) ) . toBe ( `[string, ...string[]]` ) ;
611
611
expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } , maxItems : 2 } , opts ) ) . toBe ( `[] | [string] | [string, string]` ) ;
612
- expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } , maxItems : 20 } , opts ) ) . toBe ( `( string) []` ) ;
612
+ expect ( transformSchemaObject ( { type : "array" , items : { type : "string" } , maxItems : 20 } , opts ) ) . toBe ( `string[]` ) ;
613
613
} ) ;
614
614
615
615
test ( "prefixItems" , ( ) => {
@@ -642,9 +642,9 @@ describe("Schema Object", () => {
642
642
ctx : { ...options . ctx , immutableTypes : true } ,
643
643
} ) ;
644
644
expect ( generated ) . toBe ( `{
645
- readonly array?: readonly ( {
645
+ readonly array?: readonly {
646
646
[key: string]: unknown;
647
- }) [] | null;
647
+ }[] | null;
648
648
}` ) ;
649
649
} ) ;
650
650
} ) ;
0 commit comments