@@ -12,7 +12,7 @@ const test = require("node:test");
1212const filePath = path . join ( __dirname , "../README.md" ) ;
1313
1414test ( "show modify the generated schema" , async ( t ) => {
15- t . plan ( 4 ) ;
15+ t . plan ( 6 ) ;
1616
1717 const fastify = Fastify ( {
1818 ajv : {
@@ -82,15 +82,23 @@ test("show modify the generated schema", async (t) => {
8282 // }
8383 // }
8484 // })
85- const schema =
86- fastify . swagger ( ) . paths [ "/" ] . post . requestBody . content [ "multipart/form-data" ]
87- . schema ;
88- t . assert . deepStrictEqual ( schema , {
89- type : "object" ,
90- properties : {
91- field : { type : "string" , format : "binary" } ,
85+ const post = fastify . swagger ( ) . paths [ "/" ] . post ;
86+ t . assert . strictEqual ( post . operationId , "test" ) ;
87+ // requestBody.required is not asserted because @fastify /swagger v9.7.0
88+ // introduced it (fastify/fastify-swagger#903), making it version-dependent.
89+ t . assert . deepStrictEqual ( post . requestBody . content , {
90+ "multipart/form-data" : {
91+ schema : {
92+ type : "object" ,
93+ properties : {
94+ field : { type : "string" , format : "binary" } ,
95+ } ,
96+ } ,
9297 } ,
9398 } ) ;
99+ t . assert . deepStrictEqual ( post . responses , {
100+ 200 : { description : "Default Response" } ,
101+ } ) ;
94102
95103 await fastify . listen ( { port : 0 } ) ;
96104
0 commit comments