Skip to content

Commit

Permalink
Simplify MatchQuery spec.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Jul 11, 2024
1 parent 1ca23ca commit 922d154
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions spec/schemas/_common.query_dsl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,13 @@ components:
description: |-
Returns documents that match a provided text, number, date or boolean value.
The provided text is analyzed before matching.
anyOf:
- type: object
additionalProperties:
$ref: '#/components/schemas/MatchQuery'
minProperties: 1
maxProperties: 1
- type: object
additionalProperties: true
minProperties: 1
maxProperties: 1
type: object
additionalProperties:
anyOf:
- $ref: '#/components/schemas/MatchQuery'
- true
minProperties: 1
maxProperties: 1
match_all:
$ref: '#/components/schemas/MatchAllQuery'
match_bool_prefix:
Expand Down
2 changes: 1 addition & 1 deletion tools/src/_utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { type OpenAPIV3 } from 'openapi-types'
import { type ValidationError } from 'types'

export function is_ref<O extends object> (o: MaybeRef<O>): o is OpenAPIV3.ReferenceObject {
return '$ref' in o
return typeof(o) === 'object' && '$ref' in o
}

export function is_array_schema (schema: OpenAPIV3.SchemaObject): schema is OpenAPIV3.ArraySchemaObject {
Expand Down

0 comments on commit 922d154

Please sign in to comment.