We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1bac380 commit 39e0b78Copy full SHA for 39e0b78
1 file changed
packages/typebox/src/index.ts
@@ -159,6 +159,8 @@ export const querySyntax = <
159
options: ObjectOptions = { additionalProperties: false }
160
) => {
161
const propertySchema = queryProperties(type, extensions)
162
+ const $or = Type.Array(propertySchema)
163
+ const $and = Type.Array(Type.Union([propertySchema, Type.Object({ $or })]))
164
165
return Type.Intersect(
166
[
@@ -169,8 +171,8 @@ export const querySyntax = <
169
171
$skip: Type.Number({ minimum: 0 }),
170
172
$sort: sortDefinition(type),
173
$select: arrayOfKeys(type),
- $or: Type.Array(propertySchema),
- $and: Type.Array(propertySchema)
174
+ $and,
175
+ $or
176
},
177
{ additionalProperties: false }
178
)
0 commit comments