File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -73,4 +73,47 @@ describe("valibot", () => {
7373
7474 expect ( specs ) . toMatchSnapshot ( ) ;
7575 } ) ;
76+
77+ it ( "with transformation" , async ( ) => {
78+ const app = new Hono ( ) . get (
79+ "/" ,
80+ describeRoute ( {
81+ tags : [ "test" ] ,
82+ summary : "Test route" ,
83+ description : "This is a test route" ,
84+ responses : {
85+ 200 : {
86+ description : "Success" ,
87+ content : {
88+ "application/json" : {
89+ schema : resolver ( v . string ( ) ) ,
90+ } ,
91+ } ,
92+ } ,
93+ } ,
94+ } ) ,
95+ validator (
96+ "query" ,
97+ v . object ( {
98+ names : v . pipe (
99+ v . string ( ) ,
100+ v . transform ( ( val ) => val . split ( "|" ) ) ,
101+ v . array ( v . string ( ) ) ,
102+ ) ,
103+ } ) ,
104+ undefined ,
105+ {
106+ typeMode : "output" ,
107+ } ,
108+ ) ,
109+ async ( c ) => {
110+ const { names } = await c . req . valid ( "query" ) ;
111+ return c . json ( { message : `Hello ${ names . join ( ", " ) } !` } ) ;
112+ } ,
113+ ) ;
114+
115+ const specs = await generateSpecs ( app ) ;
116+
117+ expect ( specs ) . toMatchSnapshot ( ) ;
118+ } ) ;
76119} ) ;
You can’t perform that action at this time.
0 commit comments