File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -339,6 +339,18 @@ export class ParameterizedEndpoint {
339339 test ( @PathParam ( 'objectId' ) objectId : string ) : PrimitiveClassModel {
340340 return new PrimitiveClassModel ( ) ;
341341 }
342+
343+ @Path ( '/file' )
344+ @POST
345+ file ( @FileParam ( 'file' ) file : Express . Multer . File ) : PrimitiveClassModel {
346+ return new PrimitiveClassModel ( ) ;
347+ }
348+
349+ @Path ( '/stream' )
350+ @POST
351+ stream ( @swagger . StreamFileParam ( 'stream' ) file : Express . Multer . File ) : PrimitiveClassModel {
352+ return new PrimitiveClassModel ( ) ;
353+ }
342354}
343355
344356export abstract class Entity {
Original file line number Diff line number Diff line change @@ -298,6 +298,16 @@ describe('Definition generation', () => {
298298 const expression = jsonata ( 'paths."/parameterized/{objectId}/test".get.parameters[0].in' ) ;
299299 expect ( expression . evaluate ( spec ) ) . to . eq ( 'path' ) ;
300300 } ) ;
301+
302+ it ( 'should generate formData param for params declared on method' , ( ) => {
303+ const expression = jsonata ( 'paths."/parameterized/{objectId}/file".post.parameters[0].in' ) ;
304+ expect ( expression . evaluate ( spec ) ) . to . eq ( 'formData' ) ;
305+ } ) ;
306+
307+ it ( 'should generate path param for params declared on class' , ( ) => {
308+ const expression = jsonata ( 'paths."/parameterized/{objectId}/stream".post.parameters[0].in' ) ;
309+ expect ( expression . evaluate ( spec ) ) . to . eq ( 'formData' ) ;
310+ } ) ;
301311 } ) ;
302312
303313 describe ( 'AbstractEntityEndpoint' , ( ) => {
You can’t perform that action at this time.
0 commit comments