@@ -140,6 +140,7 @@ describe("types", () => {
140140 type : "object" ,
141141 } ,
142142 object_unknown : { type : "object" } ,
143+ object_empty : { } ,
143144 } ,
144145 } ,
145146 } ;
@@ -154,6 +155,7 @@ describe("types", () => {
154155 };
155156 object_ref: { number?: number };
156157 object_unknown: { [key: string]: any };
158+ object_empty: { [key: string]: any };
157159 }
158160 }` )
159161 ) ;
@@ -179,6 +181,9 @@ describe("types", () => {
179181 } ,
180182 type : "object" ,
181183 } ,
184+ inferred_array : {
185+ items : { $ref : "#/components/schemas/array" } ,
186+ } ,
182187 string : { type : "string" } ,
183188 array_ref : {
184189 items : { $ref : "#/components/schemas/array" } ,
@@ -198,6 +203,7 @@ describe("types", () => {
198203 numbers?: number[];
199204 refs?: components['schemas']['string'][];
200205 };
206+ inferred_array: components['schemas']['array'][];
201207 string: string;
202208 array_ref: components['schemas']['array'][];
203209 }
@@ -377,7 +383,7 @@ describe("OpenAPI3 features", () => {
377383 oneOf : [
378384 { type : "string" } ,
379385 { type : "number" } ,
380- { $ref : "#/components/one_of_ref" } ,
386+ { $ref : "#/components/schemas/ one_of_ref" } ,
381387 ] ,
382388 } ,
383389 } ,
@@ -389,6 +395,26 @@ describe("OpenAPI3 features", () => {
389395 } ,
390396 type : "object" ,
391397 } ,
398+ one_of_inferred : {
399+ oneOf : [
400+ {
401+ properties : {
402+ kibana : {
403+ type : "object" ,
404+ properties : { versions : { type : "string" } } ,
405+ } ,
406+ } ,
407+ } ,
408+ {
409+ properties : {
410+ elasticsearch : {
411+ type : "object" ,
412+ properties : { versions : { type : "string" } } ,
413+ } ,
414+ } ,
415+ } ,
416+ ] ,
417+ } ,
392418 } ,
393419 } ,
394420 } ;
@@ -397,8 +423,11 @@ describe("OpenAPI3 features", () => {
397423 format ( `
398424 export interface components {
399425 schemas: {
400- one_of: { options?: string | number | components['one_of_ref'] };
426+ one_of: { options?: string | number | components['schemas'][' one_of_ref'] };
401427 one_of_ref: { boolean?: boolean };
428+ one_of_inferred:
429+ | { kibana?: { versions?: string } }
430+ | { elasticsearch?: { versions?: string } }
402431 }
403432 }` )
404433 ) ;
0 commit comments