From 069f928e803bf3ba6161ca971e3dd3940402d577 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Wed, 13 May 2020 10:23:00 -0500 Subject: [PATCH] Remove ability to ingore files from spec validation (#56647) An ignore parameter was originally added to the ValidateJsonAgainstSchemaTask to allow the build to pass for REST specs that did not properly validate against the schema. Since the introduction of this task, all schemas that did not validate have been fixed to now validate properly. This commit removes the ability to ignore specific files for validation. This allows any consumers the assurance that all REST specs validate against the schema. --- .../ValidateJsonAgainstSchemaTask.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java index 039334ce87a57..0a938ea1b4453 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/precommit/ValidateJsonAgainstSchemaTask.java @@ -29,10 +29,8 @@ import org.gradle.api.DefaultTask; import org.gradle.api.UncheckedIOException; import org.gradle.api.file.FileCollection; -import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.InputFiles; -import org.gradle.api.tasks.Optional; import org.gradle.api.tasks.OutputFile; import org.gradle.api.tasks.TaskAction; import org.gradle.work.ChangeType; @@ -42,9 +40,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.util.Arrays; import java.util.Collection; -import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; @@ -57,7 +53,6 @@ public class ValidateJsonAgainstSchemaTask extends DefaultTask { private final ObjectMapper mapper = new ObjectMapper(); - private Set ignore = new HashSet<>(); private File jsonSchema; private FileCollection inputFiles; @@ -80,16 +75,6 @@ public void setJsonSchema(File jsonSchema) { this.jsonSchema = jsonSchema; } - @Input - @Optional - public Set getIgnore() { - return ignore; - } - - public void ignore(String... ignore) { - this.ignore.addAll(Arrays.asList(ignore)); - } - @OutputFile public File getReport() { return new File(getProject().getBuildDir(), "reports/validateJson.txt"); @@ -108,9 +93,7 @@ public void validate(InputChanges inputChanges) throws IOException { .filter(f -> f.getChangeType() != ChangeType.REMOVED) .forEach(fileChange -> { File file = fileChange.getFile(); - if (ignore.contains(file.getName())) { - getLogger().debug("Ignoring file [{}] due to configuration", file.getName()); - } else if (file.isDirectory() == false) { + if (file.isDirectory() == false) { // validate all files and hold on to errors for a complete report if there are failures getLogger().debug("Validating JSON [{}]", file.getName()); try {