@@ -84,7 +84,7 @@ model Bar {
8484
8585 const { name : output } = tmp . fileSync ( { postfix : '.yaml' } ) ;
8686
87- const options = buildOptions ( model , modelFile , output , '3.1.0' ) ;
87+ const options = buildOptions ( model , modelFile , output , specVersion ) ;
8888 await generate ( model , options , dmmf ) ;
8989
9090 console . log ( `OpenAPI specification generated for ${ specVersion } : ${ output } ` ) ;
@@ -324,7 +324,7 @@ model Foo {
324324
325325 const { name : output } = tmp . fileSync ( { postfix : '.yaml' } ) ;
326326
327- const options = buildOptions ( model , modelFile , output , '3.1.0' ) ;
327+ const options = buildOptions ( model , modelFile , output , specVersion ) ;
328328 await generate ( model , options , dmmf ) ;
329329
330330 console . log ( `OpenAPI specification generated for ${ specVersion } : ${ output } ` ) ;
@@ -340,6 +340,28 @@ model Foo {
340340 }
341341 } ) ;
342342
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+
343365 it ( 'exposes individual fields from a compound id as attributes' , async ( ) => {
344366 const { model, dmmf, modelFile } = await loadZModelAndDmmf ( `
345367plugin openapi {
0 commit comments