@@ -61,6 +61,54 @@ export interface components {
61
61
62
62
export type external = Record<string, never>;
63
63
64
+ export type operations = Record<string, never>;
65
+ ` ) ;
66
+ } ) ;
67
+
68
+ test ( "components.examples are skipped" , async ( ) => {
69
+ const generated = await openapiTS ( {
70
+ openapi : "3.0" ,
71
+ info : { title : "Test" , version : "1.0" } ,
72
+ components : {
73
+ schemas : {
74
+ Example : {
75
+ type : "object" ,
76
+ properties : {
77
+ name : { type : "string" } ,
78
+ $ref : { type : "string" } ,
79
+ } ,
80
+ required : [ "name" , "$ref" ] ,
81
+ } ,
82
+ } ,
83
+ examples : {
84
+ Example : {
85
+ value : {
86
+ name : "Test" ,
87
+ $ref : "fake.yml#/components/schemas/Example" ,
88
+ } ,
89
+ } ,
90
+ } ,
91
+ } ,
92
+ } ) ;
93
+ expect ( generated ) . toBe ( `${ BOILERPLATE }
94
+ export type paths = Record<string, never>;
95
+
96
+ export interface components {
97
+ schemas: {
98
+ Example: {
99
+ name: string;
100
+ $ref: string;
101
+ };
102
+ };
103
+ responses: never;
104
+ parameters: never;
105
+ requestBodies: never;
106
+ headers: never;
107
+ pathItems: never;
108
+ }
109
+
110
+ export type external = Record<string, never>;
111
+
64
112
export type operations = Record<string, never>;
65
113
` ) ;
66
114
} ) ;
@@ -417,6 +465,12 @@ export type operations = Record<string, never>;
417
465
expect ( generated ) . toBe ( fs . readFileSync ( new URL ( "./github-api-next.ts" , EXAMPLES_DIR ) , "utf8" ) ) ;
418
466
} , 30000 ) ;
419
467
} ) ;
468
+ describe ( "Octokit GHES 3.6 Diff to API" , ( ) => {
469
+ test ( "default options" , async ( ) => {
470
+ const generated = await openapiTS ( new URL ( "./octokit-ghes-3.6-diff-to-api.yaml" , FIXTURES_DIR ) ) ;
471
+ expect ( generated ) . toBe ( fs . readFileSync ( new URL ( "./octokit-ghes-3.6-diff-to-api.ts" , EXAMPLES_DIR ) , "utf8" ) ) ;
472
+ } , 30000 ) ;
473
+ } ) ;
420
474
describe ( "Stripe" , ( ) => {
421
475
test ( "default options" , async ( ) => {
422
476
const generated = await openapiTS ( new URL ( "./stripe-api.yaml" , FIXTURES_DIR ) ) ;
0 commit comments