File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export const hasAdditionalProperties = (
7979 const properties = schema . properties as Record < string , TAnySchema >
8080
8181 if ( 'additionalProperties' in schema ) return schema . additionalProperties
82+ if ( 'patternProperties' in schema ) return false
8283
8384 for ( const key of Object . keys ( properties ) ) {
8485 const property = properties [ key ]
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'bun:test'
2+ import { Type } from '@sinclair/typebox'
3+ import { hasAdditionalProperties } from '../../src/compose'
4+
5+ describe ( 'hasAdditionalProperties' , ( ) => {
6+ it ( 'should handle object schemas without properties key' , ( ) => {
7+ const schema = Type . Intersect ( [
8+ Type . Object ( { a : Type . String ( ) } ) ,
9+ // Record schemas does not have properties key, instead it has patternProperties
10+ Type . Record ( Type . Number ( ) , Type . String ( ) )
11+ ] )
12+ expect ( hasAdditionalProperties ( schema ) ) . toBe ( false )
13+ } )
14+ } )
You can’t perform that action at this time.
0 commit comments