@@ -84,7 +84,7 @@ model Bar {
84
84
85
85
const { name : output } = tmp . fileSync ( { postfix : '.yaml' } ) ;
86
86
87
- const options = buildOptions ( model , modelFile , output , '3.1.0' ) ;
87
+ const options = buildOptions ( model , modelFile , output , specVersion ) ;
88
88
await generate ( model , options , dmmf ) ;
89
89
90
90
console . log ( `OpenAPI specification generated for ${ specVersion } : ${ output } ` ) ;
@@ -324,7 +324,7 @@ model Foo {
324
324
325
325
const { name : output } = tmp . fileSync ( { postfix : '.yaml' } ) ;
326
326
327
- const options = buildOptions ( model , modelFile , output , '3.1.0' ) ;
327
+ const options = buildOptions ( model , modelFile , output , specVersion ) ;
328
328
await generate ( model , options , dmmf ) ;
329
329
330
330
console . log ( `OpenAPI specification generated for ${ specVersion } : ${ output } ` ) ;
@@ -340,6 +340,28 @@ model Foo {
340
340
}
341
341
} ) ;
342
342
343
+ it ( 'int field as id' , async ( ) => {
344
+ const { model, dmmf, modelFile } = await loadZModelAndDmmf ( `
345
+ plugin openapi {
346
+ provider = '${ normalizePath ( path . resolve ( __dirname , '../dist' ) ) } '
347
+ }
348
+
349
+ model Foo {
350
+ id Int @id @default(autoincrement())
351
+ }
352
+ ` ) ;
353
+
354
+ const { name : output } = tmp . fileSync ( { postfix : '.yaml' } ) ;
355
+
356
+ const options = buildOptions ( model , modelFile , output , '3.0.0' ) ;
357
+ await generate ( model , options , dmmf ) ;
358
+ console . log ( `OpenAPI specification generated: ${ output } ` ) ;
359
+ await OpenAPIParser . validate ( output ) ;
360
+
361
+ const parsed = YAML . parse ( fs . readFileSync ( output , 'utf-8' ) ) ;
362
+ expect ( parsed . components . schemas . Foo . properties . id . type ) . toBe ( 'integer' ) ;
363
+ } ) ;
364
+
343
365
it ( 'exposes individual fields from a compound id as attributes' , async ( ) => {
344
366
const { model, dmmf, modelFile } = await loadZModelAndDmmf ( `
345
367
plugin openapi {
0 commit comments