File tree Expand file tree Collapse file tree 4 files changed +25
-15
lines changed Expand file tree Collapse file tree 4 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 1+ # 1.3.22 - 6 Sep 2025
2+ Bug fix:
3+ - safely unwrap t.Record
4+
15# 1.3.21 - 31 Aug 2025
26Bug fix:
37- [ #1356 ] ( https://github.com/elysiajs/elysia/pull/1356 ) webSocket validation error handling in BunAdapter
Original file line number Diff line number Diff line change 1- import { Elysia } from '../src'
1+ import { Elysia , t } from '../src'
2+ import { req } from '../test/utils'
23
3- const plugin1 = new Elysia ( ) . derive ( { as : 'scoped' } , ( ) => ( {
4- hello : 'world'
5- } ) )
4+ const app = new Elysia ( )
5+ . get ( '/' , ( ) => 'SAFE' , {
6+ query : t . Record ( t . String ( ) , t . String ( ) )
7+ } )
68
7- const plugin2 = new Elysia ( )
8- . use ( plugin1 )
9- . derive ( { as : 'scoped' } , ( { hello } ) => ( { hello } ) )
9+ const response = await app . handle ( req ( '/?x=1' ) )
1010
11- const app = new Elysia ( )
12- . use ( plugin2 )
13- // This is undefined
14- . get ( '/' , ( { hello } ) => typeof hello )
15- . listen ( 3000 )
11+ console . log ( response . status )
Original file line number Diff line number Diff line change @@ -651,12 +651,12 @@ export const composeHandler = ({
651651 if (
652652 schema &&
653653 ( schema . type === 'object' ||
654- ( schema [ Kind ] === 'Import' && schema . $defs [ schema . $ref ] ) )
654+ ( schema [ Kind ] === 'Import' && schema . $defs ?. [ schema . $ref ] ) )
655655 ) {
656656 const properties =
657- schema . properties ?? schema . $defs [ schema . $ref ] . properties
657+ schema . properties ?? schema . $defs ?. [ schema . $ref ] ? .properties
658658
659- if ( ! validator . query ! . hasAdditionalProperties )
659+ if ( properties && ! validator . query ! . hasAdditionalProperties )
660660 for ( const [ key , _value ] of Object . entries ( properties ) ) {
661661 let value = _value as TAnySchema
662662
Original file line number Diff line number Diff line change @@ -160,4 +160,14 @@ describe('Validator Additional Case', () => {
160160 expect ( res [ 0 ] . status ) . toBe ( 422 )
161161 expect ( res [ 1 ] . status ) . toBe ( 200 )
162162 } )
163+
164+ it ( 'handle record' , async ( ) => {
165+ const app = new Elysia ( ) . get ( '/' , ( ) => 'SAFE' , {
166+ query : t . Record ( t . String ( ) , t . String ( ) )
167+ } )
168+
169+ const response = await app . handle ( req ( '/?x=1' ) )
170+
171+ expect ( response . status ) . toBe ( 200 )
172+ } )
163173} )
You can’t perform that action at this time.
0 commit comments