From 3cda8d4bed4734dff61570eaba7dd191d0f9ad09 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Fri, 18 Oct 2024 10:44:41 -0400 Subject: [PATCH] PR feedback --- output/schema/schema.json | 114 ++++++++++++++++-- output/schema/validation-errors.json | 6 - output/typescript/types.ts | 11 ++ .../test/QueryRulesetTestResponse.ts | 13 +- specification/query_rules/test/types.ts | 30 ----- 5 files changed, 129 insertions(+), 45 deletions(-) delete mode 100644 specification/query_rules/test/types.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index 1c41e550c..6b4b36456 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -13721,7 +13721,7 @@ "name": "query_rules.put_ruleset", "request": { "name": "Request", - "namespace": "query_rules.test" + "namespace": "query_rules.put_ruleset" }, "requestBodyRequired": true, "requestMediaType": [ @@ -13729,7 +13729,7 @@ ], "response": { "name": "Response", - "namespace": "query_rules.test" + "namespace": "query_rules.put_ruleset" }, "responseMediaType": [ "application/json" @@ -13745,20 +13745,30 @@ }, { "availability": { - "stack": { - "stability": "experimental", + "serverless": { + "stability": "stable", "visibility": "public" + }, + "stack": { + "since": "8.10.0", + "stability": "stable" } }, - "description": "Tests a query ruleset to identify the rules that would match input criteria", + "description": "Creates or updates a query ruleset.", "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-query-ruleset.html", "name": "query_rules.test", - "request": null, + "request": { + "name": "Request", + "namespace": "query_rules.test" + }, "requestBodyRequired": true, "requestMediaType": [ "application/json" ], - "response": null, + "response": { + "name": "Response", + "namespace": "query_rules.test" + }, "responseMediaType": [ "application/json" ], @@ -182696,6 +182706,94 @@ }, "specLocation": "query_rules/put_rule/QueryRulePutResponse.ts#L22-L26" }, + { + "kind": "request", + "attachedBehaviors": [ + "CommonQueryParameters" + ], + "body": { + "kind": "properties", + "properties": [ + { + "name": "rules", + "required": true, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "QueryRule", + "namespace": "query_rules._types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "QueryRule", + "namespace": "query_rules._types" + } + } + } + ] + } + } + ] + }, + "description": "Creates or updates a query ruleset.", + "inherits": { + "type": { + "name": "RequestBase", + "namespace": "_types" + } + }, + "name": { + "name": "Request", + "namespace": "query_rules.put_ruleset" + }, + "path": [ + { + "description": "The unique identifier of the query ruleset to be created or updated", + "name": "ruleset_id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Id", + "namespace": "_types" + } + } + } + ], + "query": [], + "specLocation": "query_rules/put_ruleset/QueryRulesetPutRequest.ts#L23-L43" + }, + { + "kind": "response", + "body": { + "kind": "properties", + "properties": [ + { + "name": "result", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Result", + "namespace": "_types" + } + } + } + ] + }, + "name": { + "name": "Response", + "namespace": "query_rules.put_ruleset" + }, + "specLocation": "query_rules/put_ruleset/QueryRulesetPutResponse.ts#L22-L26" + }, { "kind": "interface", "name": { @@ -182728,7 +182826,7 @@ } } ], - "specLocation": "query_rules/test/types.ts#L21-L30" + "specLocation": "query_rules/test/QueryRulesetTestResponse.ts#L30-L39" }, { "kind": "request", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 957951e12..6b40b6b07 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1023,12 +1023,6 @@ ], "response": [] }, - "query_rules.test": { - "request": [ - "Missing request & response" - ], - "response": [] - }, "reindex": { "request": [ "Request: query parameter 'require_alias' does not exist in the json spec", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 2b9384963..32bd61bb1 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -17191,6 +17191,17 @@ export interface QueryRulesPutRuleResponse { result: Result } +export interface QueryRulesPutRulesetRequest extends RequestBase { + ruleset_id: Id + body?: { + rules: QueryRulesQueryRule | QueryRulesQueryRule[] + } +} + +export interface QueryRulesPutRulesetResponse { + result: Result +} + export interface QueryRulesTestQueryRulesetMatchedRule { ruleset_id: Id rule_id: Id diff --git a/specification/query_rules/test/QueryRulesetTestResponse.ts b/specification/query_rules/test/QueryRulesetTestResponse.ts index bf89b7220..2423da307 100644 --- a/specification/query_rules/test/QueryRulesetTestResponse.ts +++ b/specification/query_rules/test/QueryRulesetTestResponse.ts @@ -17,8 +17,8 @@ * under the License. */ +import { Id } from '@_types/common' import { integer } from '@_types/Numeric' -import { QueryRulesetMatchedRule } from './types' export class Response { body: { @@ -26,3 +26,14 @@ export class Response { matched_rules: QueryRulesetMatchedRule[] } } + +export class QueryRulesetMatchedRule { + /** + * Ruleset unique identifier + */ + ruleset_id: Id + /** + * Rule unique identifier within that ruleset + */ + rule_id: Id +} diff --git a/specification/query_rules/test/types.ts b/specification/query_rules/test/types.ts deleted file mode 100644 index 9a230fe33..000000000 --- a/specification/query_rules/test/types.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { Id } from '@_types/common' - -export class QueryRulesetMatchedRule { - /** - * Ruleset unique identifier - */ - ruleset_id: Id - /** - * Rule unique identifier within that ruleset - */ - rule_id: Id -}