Skip to content

Commit e0c41c1

Browse files
committed
Fix query validation
1 parent cc4d2ad commit e0c41c1

File tree

7 files changed

+91
-63
lines changed

7 files changed

+91
-63
lines changed

output/schema/schema.json

Lines changed: 60 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/esql/query/QueryRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import { TableValuesContainer } from '@esql/_types/TableValuesContainer'
2121
import { Dictionary } from '@spec_utils/Dictionary'
2222
import { RequestBase } from '@_types/Base'
23-
import { FieldValue } from '@_types/common'
2423
import { QueryContainer } from '@_types/query_dsl/abstractions'
24+
import { EsqlQueryParameters } from './types'
2525

2626
/**
2727
* Executes an ES|QL request
@@ -68,7 +68,7 @@ export interface Request extends RequestBase {
6868
* To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters.
6969
* @doc_id esql-query-params
7070
*/
71-
params?: Array<FieldValue>
71+
params?: EsqlQueryParameters
7272
/**
7373
* If provided and `true` the response will include an extra `profile` object
7474
* with information on how the query was executed. This information is for human debugging

specification/esql/query/types.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { SingleKeyDictionary } from '@spec_utils/Dictionary'
21+
import { Field, FieldValue } from '@_types/common'
22+
23+
export type EsqlQueryParameters =
24+
| FieldValue[]
25+
| SingleKeyDictionary<Field, FieldValue>

specification/sql/types.ts renamed to specification/sql/_types/types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
* under the License.
1818
*/
1919

20-
import { Dictionary } from '@spec_utils/Dictionary'
2120
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2221
import { Name } from '@_types/common'
2322

@@ -27,7 +26,3 @@ export class Column {
2726
}
2827

2928
export type Row = UserDefinedValue[]
30-
31-
export type QueryParameters =
32-
| Dictionary<string, UserDefinedValue>
33-
| UserDefinedValue[]

specification/sql/get_async/SqlGetAsyncResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Id } from '@_types/common'
21-
import { Column, Row } from '../types'
21+
import { Column, Row } from '../_types/types'
2222

2323
export class Response {
2424
body: {

specification/sql/query/QuerySqlRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* under the License.
1818
*/
1919

20-
import { QueryParameters } from '@sql/types'
2120
import { RequestBase } from '@_types/Base'
21+
import { FieldValue } from '@_types/common'
2222
import { RuntimeFields } from '@_types/mapping/RuntimeFields'
2323
import { integer } from '@_types/Numeric'
2424
import { QueryContainer } from '@_types/query_dsl/abstractions'
@@ -101,7 +101,7 @@ export interface Request extends RequestBase {
101101
/**
102102
* Values for parameters in the query.
103103
*/
104-
params?: QueryParameters
104+
params?: FieldValue[]
105105
/**
106106
* Retention period for an async or saved synchronous search.
107107
* @server_default 5d

specification/sql/query/QuerySqlResponse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
import { Id } from '@_types/common'
21-
import { Column, Row } from '../types'
21+
import { Column, Row } from '../_types/types'
2222

2323
export class Response {
2424
body: {

0 commit comments

Comments
 (0)