From 8113beb1e9d5e019fc4d50c066b7479ebe2d8813 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Fri, 2 Aug 2024 00:24:12 +0500 Subject: [PATCH 1/5] adding ppl namespace api specs Signed-off-by: Tokesh --- spec/namespaces/ppl.yaml | 173 ++++++++++++++++++++++++++++++++++ spec/namespaces/sql.yaml | 8 +- spec/schemas/sql._common.yaml | 14 +-- tests/ppl/explain.yaml | 22 +++++ tests/ppl/query.yaml | 24 +++++ tests/ppl/stats.yaml | 11 +++ 6 files changed, 241 insertions(+), 11 deletions(-) create mode 100644 spec/namespaces/ppl.yaml create mode 100644 tests/ppl/explain.yaml create mode 100644 tests/ppl/query.yaml create mode 100644 tests/ppl/stats.yaml diff --git a/spec/namespaces/ppl.yaml b/spec/namespaces/ppl.yaml new file mode 100644 index 000000000..9ee46f7b1 --- /dev/null +++ b/spec/namespaces/ppl.yaml @@ -0,0 +1,173 @@ +openapi: 3.1.0 +info: + title: OpenSearch PPL API + description: OpenSearch PPL API + version: 1.0.0 +paths: + /_plugins/_ppl: + post: + operationId: ppl.query.0 + x-operation-group: ppl.query + x-version-added: '1.0' + description: Send a PPL query to the PPL plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.query::query.format' + - $ref: '#/components/parameters/ppl.query::query.sanitize' + requestBody: + $ref: '#/components/requestBodies/ppl.query' + responses: + '200': + $ref: '#/components/responses/ppl.query@200' + /_plugins/_ppl/_explain: + post: + operationId: ppl.explain.0 + x-operation-group: ppl.explain + x-version-added: '1.0' + description: Shows how a query is executed against OpenSearch. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/ppl.explain::query.format' + - $ref: '#/components/parameters/ppl.explain::query.sanitize' + requestBody: + $ref: '#/components/requestBodies/ppl.explain' + responses: + '200': + $ref: '#/components/responses/ppl.explain@200' + /_plugins/_ppl/stats: + get: + operationId: ppl.get_stats.0 + x-operation-group: ppl.get_stats + x-version-added: '1.0' + description: Collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.get_stats::query.format' + - $ref: '#/components/parameters/ppl.get_stats::query.sanitize' + responses: + '200': + $ref: '#/components/responses/ppl.get_stats@200' + post: + operationId: ppl.post_stats.1 + x-operation-group: ppl.post_stats + x-version-added: '1.0' + description: By a stats endpoint, you are able to collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/ppl.post_stats::query.format' + - $ref: '#/components/parameters/ppl.post_stats::query.sanitize' + requestBody: + $ref: '#/components/requestBodies/ppl.post_stats' + responses: + '200': + $ref: '#/components/responses/ppl.post_stats@200' +components: + parameters: + ppl.query::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + ppl.query::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + ppl.explain::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + ppl.explain::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + ppl.get_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + ppl.get_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + ppl.post_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + ppl.post_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + requestBodies: + ppl.query: + content: + application/json: + schema: + $ref: '../schemas/sql._common.yaml#/components/schemas/Query' + required: true + ppl.explain: + content: + application/json: + schema: + $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' + required: true + ppl.post_stats: + content: + application/json: + schema: + $ref: '../schemas/sql._common.yaml#/components/schemas/SqlStats' + required: true + responses: + ppl.query@200: + description: '' + content: + application/json: + schema: + $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' + ppl.explain@200: + content: + application/json: + schema: + $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' + required: true + ppl.get_stats@200: + content: + text/plain: + schema: + type: string + required: true + ppl.post_stats@200: + content: + text/plain: + schema: + type: string + required: true \ No newline at end of file diff --git a/spec/namespaces/sql.yaml b/spec/namespaces/sql.yaml index 0afdde2d8..2759a4077 100644 --- a/spec/namespaces/sql.yaml +++ b/spec/namespaces/sql.yaml @@ -163,13 +163,13 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlQuery' + $ref: '../schemas/sql._common.yaml#/components/schemas/Query' required: true sql.explain: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlExplain' + $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' required: true sql.close: content: @@ -189,12 +189,12 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlQueryResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' sql.explain@200: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlExplainResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' required: true sql.close@200: content: diff --git a/spec/schemas/sql._common.yaml b/spec/schemas/sql._common.yaml index ea1abf9f0..99ddfb73f 100644 --- a/spec/schemas/sql._common.yaml +++ b/spec/schemas/sql._common.yaml @@ -6,7 +6,7 @@ info: paths: {} components: schemas: - SqlQuery: + Query: type: object properties: query: @@ -15,7 +15,7 @@ components: type: object fetch_size: type: integer - SqlQueryResponse: + QueryResponse: type: object properties: schema: @@ -34,7 +34,7 @@ components: type: integer status: type: integer - SqlExplain: + Explain: type: object properties: query: @@ -43,12 +43,12 @@ components: type: object fetch_size: type: integer - SqlExplainResponse: + ExplainResponse: type: object properties: root: - $ref: '#/components/schemas/Explain' - Explain: + $ref: '#/components/schemas/ExplainBody' + ExplainBody: type: object properties: name: @@ -58,7 +58,7 @@ components: children: type: array items: - $ref: '#/components/schemas/Explain' + $ref: '#/components/schemas/ExplainBody' SqlClose: type: object properties: diff --git a/tests/ppl/explain.yaml b/tests/ppl/explain.yaml new file mode 100644 index 000000000..84ca81d92 --- /dev/null +++ b/tests/ppl/explain.yaml @@ -0,0 +1,22 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test how a query is executed against OpenSearch. + +prologues: + - path: /books + method: PUT + request_body: + payload: {} +epilogues: + - path: /books + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get explain of SQL Query + path: /_plugins/_ppl/_explain + method: POST + request_body: + payload: + query: 'search source=books;' + response: + status: 200 diff --git a/tests/ppl/query.yaml b/tests/ppl/query.yaml new file mode 100644 index 000000000..cf65ce1f2 --- /dev/null +++ b/tests/ppl/query.yaml @@ -0,0 +1,24 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test send SQL query to index. + +prologues: + - path: /{index} + method: PUT + parameters: + index: books + request_body: + payload: {} +epilogues: + - path: /books + method: DELETE + status: [200, 404] +chapters: + - synopsis: Get PPL query + path: /_plugins/_ppl + method: POST + request_body: + payload: + query: 'search source=books;' + response: + status: 200 \ No newline at end of file diff --git a/tests/ppl/stats.yaml b/tests/ppl/stats.yaml new file mode 100644 index 000000000..ffd796e42 --- /dev/null +++ b/tests/ppl/stats.yaml @@ -0,0 +1,11 @@ +$schema: ../../json_schemas/test_story.schema.yaml + +description: Test get SQL Queries stats. + +chapters: + - synopsis: Get stats from SQL Query. + path: /_plugins/_ppl/stats + method: POST + response: + status: 200 + content_type: text/plain \ No newline at end of file From 8b714e9f9c438d01af969c478c54cf6d830a00e8 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Fri, 2 Aug 2024 00:26:55 +0500 Subject: [PATCH 2/5] fix lint and adding changelog Signed-off-by: Tokesh --- CHANGELOG.md | 1 + tests/ppl/explain.yaml | 2 +- tests/ppl/query.yaml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a76163f31..0df2df6e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `plugins` to NodeInfoSettings ([#442](https://github.com/opensearch-project/opensearch-api-specification/pull/442)) - Added test coverage ([#443](https://github.com/opensearch-project/opensearch-api-specification/pull/443)) - Added `--opensearch-version` to `merger` that excludes schema elements per semver ([#428](https://github.com/opensearch-project/opensearch-api-specification/pull/428)) +- Added `/_plugins/_ppl`, `explain` and `stats` ([#460](https://github.com/opensearch-project/opensearch-api-specification/pull/460)) ### Changed diff --git a/tests/ppl/explain.yaml b/tests/ppl/explain.yaml index 84ca81d92..7fa91542a 100644 --- a/tests/ppl/explain.yaml +++ b/tests/ppl/explain.yaml @@ -17,6 +17,6 @@ chapters: method: POST request_body: payload: - query: 'search source=books;' + query: search source=books; response: status: 200 diff --git a/tests/ppl/query.yaml b/tests/ppl/query.yaml index cf65ce1f2..666cfb547 100644 --- a/tests/ppl/query.yaml +++ b/tests/ppl/query.yaml @@ -19,6 +19,6 @@ chapters: method: POST request_body: payload: - query: 'search source=books;' + query: search source=books; response: status: 200 \ No newline at end of file From 88ffd258bad004a7b488dbae58cdf76c637ad0c8 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Fri, 2 Aug 2024 23:25:13 +0500 Subject: [PATCH 3/5] reusing already defined structures Signed-off-by: Tokesh --- spec/namespaces/ppl.yaml | 18 ++----- spec/namespaces/sql.yaml | 10 ++-- spec/schemas/_plugins._common.yaml | 78 ++++++++++++++++++++++++++++++ spec/schemas/sql._common.yaml | 72 +-------------------------- 4 files changed, 89 insertions(+), 89 deletions(-) create mode 100644 spec/schemas/_plugins._common.yaml diff --git a/spec/namespaces/ppl.yaml b/spec/namespaces/ppl.yaml index 9ee46f7b1..0de40ba15 100644 --- a/spec/namespaces/ppl.yaml +++ b/spec/namespaces/ppl.yaml @@ -73,7 +73,6 @@ components: description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. ppl.query::query.sanitize: name: sanitize in: query @@ -81,14 +80,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results ppl.explain::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. ppl.explain::query.sanitize: name: sanitize in: query @@ -96,14 +93,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results ppl.get_stats::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. ppl.get_stats::query.sanitize: name: sanitize in: query @@ -111,14 +106,12 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results ppl.post_stats::query.format: name: format in: query description: A short version of the Accept header, e.g. json, yaml. schema: type: string - description: A short version of the Accept header, e.g. json, yaml. ppl.post_stats::query.sanitize: name: sanitize in: query @@ -126,25 +119,24 @@ components: schema: type: boolean default: true - description: Specifies whether to escape special characters in the results requestBodies: ppl.query: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/Query' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Query' required: true ppl.explain: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Explain' required: true ppl.post_stats: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlStats' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Stats' required: true responses: ppl.query@200: @@ -152,12 +144,12 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/QueryResponse' ppl.explain@200: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/ExplainResponse' required: true ppl.get_stats@200: content: diff --git a/spec/namespaces/sql.yaml b/spec/namespaces/sql.yaml index 2759a4077..1205026e6 100644 --- a/spec/namespaces/sql.yaml +++ b/spec/namespaces/sql.yaml @@ -163,13 +163,13 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/Query' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Query' required: true sql.explain: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Explain' required: true sql.close: content: @@ -181,7 +181,7 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/SqlStats' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/Stats' required: true responses: sql.query@200: @@ -189,12 +189,12 @@ components: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/QueryResponse' sql.explain@200: content: application/json: schema: - $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' + $ref: '../schemas/_plugins._common.yaml#/components/schemas/ExplainResponse' required: true sql.close@200: content: diff --git a/spec/schemas/_plugins._common.yaml b/spec/schemas/_plugins._common.yaml new file mode 100644 index 000000000..8c8f81d9d --- /dev/null +++ b/spec/schemas/_plugins._common.yaml @@ -0,0 +1,78 @@ +openapi: 3.1.0 +info: + title: Schemas of _plugins._common category. + description: Schemas of _plugins._common category. + version: 1.0.0 +paths: {} +components: + schemas: + Query: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + QueryResponse: + type: object + properties: + schema: + type: array + items: + type: object + datarows: + type: array + items: + type: array + cursor: + type: string + total: + type: integer + size: + type: integer + status: + type: integer + Explain: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + ExplainResponse: + type: object + properties: + root: + $ref: '#/components/schemas/ExplainBody' + ExplainBody: + type: object + properties: + name: + type: string + description: + type: object + children: + type: array + items: + $ref: '#/components/schemas/ExplainBody' + Stats: + type: object + properties: + start_time: + type: string + end_time: + type: object + cluster_name: + type: object + index: + type: object + query: + type: object + user: + type: object + execution_time: + type: object \ No newline at end of file diff --git a/spec/schemas/sql._common.yaml b/spec/schemas/sql._common.yaml index 99ddfb73f..b91790db0 100644 --- a/spec/schemas/sql._common.yaml +++ b/spec/schemas/sql._common.yaml @@ -6,59 +6,6 @@ info: paths: {} components: schemas: - Query: - type: object - properties: - query: - type: string - filter: - type: object - fetch_size: - type: integer - QueryResponse: - type: object - properties: - schema: - type: array - items: - type: object - datarows: - type: array - items: - type: array - cursor: - type: string - total: - type: integer - size: - type: integer - status: - type: integer - Explain: - type: object - properties: - query: - type: string - filter: - type: object - fetch_size: - type: integer - ExplainResponse: - type: object - properties: - root: - $ref: '#/components/schemas/ExplainBody' - ExplainBody: - type: object - properties: - name: - type: string - description: - type: object - children: - type: array - items: - $ref: '#/components/schemas/ExplainBody' SqlClose: type: object properties: @@ -68,21 +15,4 @@ components: type: object properties: succeeded: - type: boolean - SqlStats: - type: object - properties: - start_time: - type: string - end_time: - type: object - cluster_name: - type: object - index: - type: object - query: - type: object - user: - type: object - execution_time: - type: object \ No newline at end of file + type: boolean \ No newline at end of file From aea69f2ebe8641ec7d37d397fd8d2acdf7bc44d3 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Sat, 3 Aug 2024 00:24:27 +0500 Subject: [PATCH 4/5] edit of test descriptions Signed-off-by: Tokesh --- tests/ppl/query.yaml | 2 +- tests/ppl/stats.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ppl/query.yaml b/tests/ppl/query.yaml index 666cfb547..b561508c1 100644 --- a/tests/ppl/query.yaml +++ b/tests/ppl/query.yaml @@ -1,6 +1,6 @@ $schema: ../../json_schemas/test_story.schema.yaml -description: Test send SQL query to index. +description: Test send PPL query to index. prologues: - path: /{index} diff --git a/tests/ppl/stats.yaml b/tests/ppl/stats.yaml index ffd796e42..ec2786432 100644 --- a/tests/ppl/stats.yaml +++ b/tests/ppl/stats.yaml @@ -3,7 +3,7 @@ $schema: ../../json_schemas/test_story.schema.yaml description: Test get SQL Queries stats. chapters: - - synopsis: Get stats from SQL Query. + - synopsis: Get stats from PPL Query. path: /_plugins/_ppl/stats method: POST response: From 4b157ace486f150222dbcbde6991ddfaf79fc614 Mon Sep 17 00:00:00 2001 From: Tokesh Date: Sat, 3 Aug 2024 18:38:05 +0500 Subject: [PATCH 5/5] fixing descriptions, file structure and deleting semicolons from requestbody Signed-off-by: Tokesh --- spec/namespaces/ppl.yaml | 18 +++---- spec/namespaces/sql.yaml | 10 ++-- spec/schemas/_plugins._common.yaml | 78 ------------------------------ spec/schemas/sql._common.yaml | 74 +++++++++++++++++++++++++++- tests/ppl/explain.yaml | 2 +- tests/ppl/query.yaml | 2 +- 6 files changed, 88 insertions(+), 96 deletions(-) delete mode 100644 spec/schemas/_plugins._common.yaml diff --git a/spec/namespaces/ppl.yaml b/spec/namespaces/ppl.yaml index 0de40ba15..7515cea94 100644 --- a/spec/namespaces/ppl.yaml +++ b/spec/namespaces/ppl.yaml @@ -76,7 +76,7 @@ components: ppl.query::query.sanitize: name: sanitize in: query - description: Specifies whether to escape special characters in the results + description: Specifies whether to escape special characters in the results. schema: type: boolean default: true @@ -89,7 +89,7 @@ components: ppl.explain::query.sanitize: name: sanitize in: query - description: Specifies whether to escape special characters in the results + description: Specifies whether to escape special characters in the results. schema: type: boolean default: true @@ -102,7 +102,7 @@ components: ppl.get_stats::query.sanitize: name: sanitize in: query - description: Specifies whether to escape special characters in the results + description: Specifies whether to escape special characters in the results. schema: type: boolean default: true @@ -115,7 +115,7 @@ components: ppl.post_stats::query.sanitize: name: sanitize in: query - description: Specifies whether to escape special characters in the results + description: Specifies whether to escape special characters in the results. schema: type: boolean default: true @@ -124,19 +124,19 @@ components: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Query' + $ref: '../schemas/sql._common.yaml#/components/schemas/Query' required: true ppl.explain: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Explain' + $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' required: true ppl.post_stats: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Stats' + $ref: '../schemas/sql._common.yaml#/components/schemas/Stats' required: true responses: ppl.query@200: @@ -144,12 +144,12 @@ components: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/QueryResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' ppl.explain@200: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/ExplainResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' required: true ppl.get_stats@200: content: diff --git a/spec/namespaces/sql.yaml b/spec/namespaces/sql.yaml index 2e1790d5f..7de1b1c22 100644 --- a/spec/namespaces/sql.yaml +++ b/spec/namespaces/sql.yaml @@ -182,13 +182,13 @@ components: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Query' + $ref: '../schemas/sql._common.yaml#/components/schemas/Query' required: true sql.explain: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Explain' + $ref: '../schemas/sql._common.yaml#/components/schemas/Explain' required: true sql.close: content: @@ -200,7 +200,7 @@ components: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/Stats' + $ref: '../schemas/sql._common.yaml#/components/schemas/Stats' required: true responses: sql.settings@200: @@ -212,12 +212,12 @@ components: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/QueryResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/QueryResponse' sql.explain@200: content: application/json: schema: - $ref: '../schemas/_plugins._common.yaml#/components/schemas/ExplainResponse' + $ref: '../schemas/sql._common.yaml#/components/schemas/ExplainResponse' required: true sql.close@200: content: diff --git a/spec/schemas/_plugins._common.yaml b/spec/schemas/_plugins._common.yaml deleted file mode 100644 index 8c8f81d9d..000000000 --- a/spec/schemas/_plugins._common.yaml +++ /dev/null @@ -1,78 +0,0 @@ -openapi: 3.1.0 -info: - title: Schemas of _plugins._common category. - description: Schemas of _plugins._common category. - version: 1.0.0 -paths: {} -components: - schemas: - Query: - type: object - properties: - query: - type: string - filter: - type: object - fetch_size: - type: integer - QueryResponse: - type: object - properties: - schema: - type: array - items: - type: object - datarows: - type: array - items: - type: array - cursor: - type: string - total: - type: integer - size: - type: integer - status: - type: integer - Explain: - type: object - properties: - query: - type: string - filter: - type: object - fetch_size: - type: integer - ExplainResponse: - type: object - properties: - root: - $ref: '#/components/schemas/ExplainBody' - ExplainBody: - type: object - properties: - name: - type: string - description: - type: object - children: - type: array - items: - $ref: '#/components/schemas/ExplainBody' - Stats: - type: object - properties: - start_time: - type: string - end_time: - type: object - cluster_name: - type: object - index: - type: object - query: - type: object - user: - type: object - execution_time: - type: object \ No newline at end of file diff --git a/spec/schemas/sql._common.yaml b/spec/schemas/sql._common.yaml index d4eeab380..d9f50ade1 100644 --- a/spec/schemas/sql._common.yaml +++ b/spec/schemas/sql._common.yaml @@ -6,6 +6,76 @@ info: paths: {} components: schemas: + Query: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + QueryResponse: + type: object + properties: + schema: + type: array + items: + type: object + datarows: + type: array + items: + type: array + cursor: + type: string + total: + type: integer + size: + type: integer + status: + type: integer + Explain: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + ExplainResponse: + type: object + properties: + root: + $ref: '#/components/schemas/ExplainBody' + ExplainBody: + type: object + properties: + name: + type: string + description: + type: object + children: + type: array + items: + $ref: '#/components/schemas/ExplainBody' + Stats: + type: object + properties: + start_time: + type: string + end_time: + type: object + cluster_name: + type: object + index: + type: object + query: + type: object + user: + type: object + execution_time: + type: object SqlClose: type: object properties: @@ -46,7 +116,7 @@ components: ppl: $ref: '#/components/schemas/Ppl' query: - $ref: '#/components/schemas/Query' + $ref: '#/components/schemas/PluginsQuery' sql: $ref: '#/components/schemas/Sql' Ppl: @@ -56,7 +126,7 @@ components: anyOf: - type: boolean - type: string - Query: + PluginsQuery: type: object properties: memory_limit: diff --git a/tests/ppl/explain.yaml b/tests/ppl/explain.yaml index 7fa91542a..0dbc465ea 100644 --- a/tests/ppl/explain.yaml +++ b/tests/ppl/explain.yaml @@ -17,6 +17,6 @@ chapters: method: POST request_body: payload: - query: search source=books; + query: search source=books response: status: 200 diff --git a/tests/ppl/query.yaml b/tests/ppl/query.yaml index b561508c1..53a9720d3 100644 --- a/tests/ppl/query.yaml +++ b/tests/ppl/query.yaml @@ -19,6 +19,6 @@ chapters: method: POST request_body: payload: - query: search source=books; + query: search source=books response: status: 200 \ No newline at end of file