@@ -209,3 +209,27 @@ test('vue-query issue-1026 keeps header params out of the query key getter', asy
209209 expect ( content ) . toContain ( 'headers?: MaybeRef<GetSomeEndpointHeaders>' ) ;
210210 expect ( content ) . toContain ( 'headers = unref(headers);' ) ;
211211} ) ;
212+
213+ test ( 'default issue-1107 emits exports for schemas defined via cross-file $ref' , async ( ) => {
214+ // Regression for #1107: a top-level `components.schemas.X` that is itself a
215+ // cross-file `$ref` (X -> another file's X) used to generate a schema file
216+ // with the import but no `export` for X, producing a dangling, unusable
217+ // module. Each referenced schema must still be a usable exported type.
218+ // Keep this focused assertion alongside the snapshot so #1107 fails with a
219+ // targeted message instead of a full-file snapshot diff.
220+ const model = ( file : string ) =>
221+ readFile (
222+ generated ( 'default' , 'issue-1107-cross-file-ref' , 'model' , file ) ,
223+ 'utf8' ,
224+ ) ;
225+
226+ // Object schemas reached through a cross-file `$ref` are exported as types.
227+ expect ( await model ( 'pet.ts' ) ) . toContain ( 'export interface Pet {' ) ;
228+ expect ( await model ( 'error.ts' ) ) . toContain ( 'export interface Error {' ) ;
229+
230+ // The array schema both imports its item type and exports its own alias;
231+ // the missing `export type` line was the #1107 bug.
232+ const pets = await model ( 'pets.ts' ) ;
233+ expect ( pets ) . toContain ( "import type { Pet } from './pet';" ) ;
234+ expect ( pets ) . toContain ( 'export type Pets = Pet[];' ) ;
235+ } ) ;
0 commit comments