From 25dcd29ac0984ad6db4055d90adc126294515520 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Fri, 24 Apr 2020 15:16:15 -0500 Subject: [PATCH 1/7] json spec: allow null for documentation url --- rest-api-spec/src/main/resources/schema.json | 2 +- x-pack/plugin/build.gradle | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/rest-api-spec/src/main/resources/schema.json b/rest-api-spec/src/main/resources/schema.json index 16418116b51de..9c7f7aa445977 100644 --- a/rest-api-spec/src/main/resources/schema.json +++ b/rest-api-spec/src/main/resources/schema.json @@ -130,7 +130,7 @@ "additionalProperties": false, "properties": { "url": { - "type": "string", + "type": ["string", "null"], "format": "uri" }, "description": { diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index ea39e343fec9b..198547e2db457 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/build.gradle @@ -119,6 +119,4 @@ validateRestSpec { ignore 'autoscaling.delete_autoscaling_policy.json' ignore 'autoscaling.get_autoscaling_policy.json' ignore 'autoscaling.put_autoscaling_policy.json' - ignore 'ml.validate.json' - ignore 'ml.validate_detector.json' } From 0b379774dc73b545c9e1f3be89f89c8e3de79bf8 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 29 Apr 2020 16:44:13 -0500 Subject: [PATCH 2/7] conditional null --- rest-api-spec/src/main/resources/schema.json | 33 +++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/rest-api-spec/src/main/resources/schema.json b/rest-api-spec/src/main/resources/schema.json index 9c7f7aa445977..0ca1ba49a8f05 100644 --- a/rest-api-spec/src/main/resources/schema.json +++ b/rest-api-spec/src/main/resources/schema.json @@ -43,6 +43,37 @@ "$ref": "#/definitions/Body" } }, + "if": { + "properties": { + "stability": { + "const": "stable" + } + } + }, + "then": { + "properties": { + "documentation": { + "$ref": "#/definitions/Documentation", + "properties": { + "url" : { + "type": ["string"] + } + } + } + } + }, + "else": { + "properties": { + "documentation": { + "$ref": "#/definitions/Documentation", + "properties": { + "url" : { + "type": ["string", "null"] + } + } + } + } + }, "required": [ "documentation", "stability", @@ -130,7 +161,7 @@ "additionalProperties": false, "properties": { "url": { - "type": ["string", "null"], + "type": ["string"], "format": "uri" }, "description": { From f3e5af79c8bddb82246f2dd8bb9127f99aac0c89 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Thu, 7 May 2020 13:02:19 -0500 Subject: [PATCH 3/7] move ml specs to private --- rest-api-spec/src/main/resources/schema.json | 1 - .../src/test/resources/rest-api-spec/api/ml.validate.json | 2 +- .../test/resources/rest-api-spec/api/ml.validate_detector.json | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rest-api-spec/src/main/resources/schema.json b/rest-api-spec/src/main/resources/schema.json index 0ca1ba49a8f05..6ae10164ee7b8 100644 --- a/rest-api-spec/src/main/resources/schema.json +++ b/rest-api-spec/src/main/resources/schema.json @@ -161,7 +161,6 @@ "additionalProperties": false, "properties": { "url": { - "type": ["string"], "format": "uri" }, "description": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json index ffbede6b1e387..ed01635f124ff 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json @@ -4,7 +4,7 @@ "url":null, "description":"Validates an anomaly detection job." }, - "stability":"stable", + "stability":"private", "url":{ "paths":[ { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json index f4cee6d5c270d..b8a20349c73be 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json @@ -4,7 +4,7 @@ "url":null, "description":"Validates an anomaly detection detector." }, - "stability":"stable", + "stability":"private", "url":{ "paths":[ { From 0e606dbe5fcfecf6e581ae2bba74a24d2004c124 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 08:00:52 -0500 Subject: [PATCH 4/7] Update x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json Co-authored-by: Russ Cam --- .../test/resources/rest-api-spec/api/ml.validate_detector.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json index b8a20349c73be..83820c2637f5d 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json @@ -1,7 +1,7 @@ { "ml.validate_detector":{ "documentation":{ - "url":null, + "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", "description":"Validates an anomaly detection detector." }, "stability":"private", From 5e47c78c76ead60f92b9a469dbac3355a94e5551 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 08:01:01 -0500 Subject: [PATCH 5/7] Update x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json Co-authored-by: Russ Cam --- .../src/test/resources/rest-api-spec/api/ml.validate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json index ed01635f124ff..de95b40713771 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json @@ -1,7 +1,7 @@ { "ml.validate":{ "documentation":{ - "url":null, + "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", "description":"Validates an anomaly detection job." }, "stability":"private", From e3d7004dec60ea53f4234f21010b258a8de3df8f Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 08:01:09 -0500 Subject: [PATCH 6/7] Update x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json Co-authored-by: Russ Cam --- .../src/test/resources/rest-api-spec/api/ml.validate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json index de95b40713771..46f6e8337efdc 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json @@ -4,7 +4,7 @@ "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", "description":"Validates an anomaly detection job." }, - "stability":"private", + "stability":"stable", "url":{ "paths":[ { From 93dfadfae0be6f90bb061617f10b4abb977b7247 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Tue, 12 May 2020 08:01:16 -0500 Subject: [PATCH 7/7] Update x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json Co-authored-by: Russ Cam --- .../test/resources/rest-api-spec/api/ml.validate_detector.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json index 83820c2637f5d..336b81aaaaf87 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json @@ -4,7 +4,7 @@ "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", "description":"Validates an anomaly detection detector." }, - "stability":"private", + "stability":"stable", "url":{ "paths":[ {