Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/generators/src/app/templates/configuration.tpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import type { Static } from '@feathersjs/typebox'

import { dataValidator } from './validators'

export const configurationSchema = Type.Intersect([
export const configurationSchema = Type.Composite([
defaultAppConfiguration,
Type.Object({
host: Type.String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const ${camelName}QueryProperties = Type.Pick(${camelName}Schema, [
: `'text'`
}
])
export const ${camelName}QuerySchema = Type.Intersect([
export const ${camelName}QuerySchema = Type.Composite([
querySyntax(${camelName}QueryProperties),
// Add additional query properties here
Type.Object({}, { additionalProperties: false })
Expand Down
4 changes: 2 additions & 2 deletions packages/typebox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"dependencies": {
"@feathersjs/schema": "^5.0.30",
"@sinclair/typebox": "^0.25.0"
"@sinclair/typebox": "^0.33.9"
},
"devDependencies": {
"@types/mocha": "^10.0.7",
Expand All @@ -65,4 +65,4 @@
"typescript": "^5.5.4"
},
"gitHead": "90caf635aec850550b9d37bea2762af959d9e8d5"
}
}
27 changes: 11 additions & 16 deletions packages/typebox/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,16 @@ export const queryProperty = <T extends TSchema, X extends { [key: string]: TSch
Type.Union([
def,
Type.Partial(
Type.Intersect(
[
Type.Object({
$gt: def,
$gte: def,
$lt: def,
$lte: def,
$ne: def,
$in: def.type === 'array' ? def : Type.Array(def),
$nin: def.type === 'array' ? def : Type.Array(def)
}),
Type.Object(extension)
],
{ additionalProperties: false }
)
Type.Object({
$gt: def,
$gte: def,
$lt: def,
$lte: def,
$ne: def,
$in: def.type === 'array' ? def : Type.Array(def),
$nin: def.type === 'array' ? def : Type.Array(def),
...extension
})
)
])
)
Expand Down Expand Up @@ -176,7 +171,7 @@ export const querySyntax = <
const $or = Type.Array(propertySchema)
const $and = Type.Array(Type.Union([propertySchema, Type.Object({ $or })]))

return Type.Intersect(
return Type.Composite(
[
Type.Partial(
Type.Object(
Expand Down
2 changes: 1 addition & 1 deletion packages/typebox/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ describe('@feathersjs/schema/typebox', () => {
})

it('defaultAppConfiguration', async () => {
const configSchema = Type.Intersect([
const configSchema = Type.Composite([
defaultAppConfiguration,
Type.Object({
host: Type.String(),
Expand Down