Class ValidateTask

  • All Implemented Interfaces:
    kotlin.Comparable , org.gradle.api.Named , org.gradle.api.Task , org.gradle.api.internal.DynamicObjectAware , org.gradle.api.internal.TaskInternal , org.gradle.api.plugins.ExtensionAware , org.gradle.util.Configurable

    @CacheableTask() 
    public abstract class ValidateTask
    extends DefaultTask
                        

    A generator which validates an Open API spec. This task outputs a list of validation issues and errors.

    Example: cli:

    ./gradlew openApiValidate --input=/path/to/file

    build.gradle.kts:

    openApiValidate { inputSpec.set(layout.projectDirectory.file("path/to/spec.yaml")) }

    Author:

    Jim Schubert

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ValidateTask()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract ProjectLayout getLayout()
      abstract RegularFileProperty getInputSpec() The local OpenAPI 2.0/3.x specification file to validate.
      abstract Property<String> getRemoteInputSpec() The remote OpenAPI 2.0/3.x specification URL to validate.
      abstract Property<Boolean> getRecommend() Whether to include recommendations in the validation output.
      abstract Property<Boolean> getTreatWarningsAsErrors() When true, the task fails if the spec produces validation warnings.
      final Unit setInput(String value)
      final Unit doWork()
      final Unit set(RegularFileProperty $self, String path) Extension function to allow setting inputSpec with a String path in Kotlin DSL.
      final Unit setInputSpecAsString(String path) Groovy-compatible setter for inputSpec property.
      • Methods inherited from class org.gradle.api.DefaultTask

        getActions, getAnt, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, setActions, setDescription, setDidWork, setEnabled, setEnabled, setGroup
      • Methods inherited from class org.gradle.api.internal.AbstractTask

        getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, setImpliesSubProjects
      • Methods inherited from class org.gradle.api.Task

        configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, doNotTrackState, finalizedBy, getConvention, hasProperty, mustRunAfter, notCompatibleWithConfigurationCache, onlyIf, onlyIf, onlyIf, property, setDependsOn, setFinalizedBy, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
      • Methods inherited from class kotlin.Comparable

        compareTo
      • Methods inherited from class org.gradle.api.internal.TaskInternal

        acceptServiceReferences, appendParallelSafeAction, hasTaskActions, prependParallelSafeAction
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ValidateTask

        ValidateTask()
    • Method Detail

      • getLayout

        @Inject() abstract ProjectLayout getLayout()
      • getInputSpec

        @Optional()@InputFile()@PathSensitive(value = PathSensitivity.RELATIVE) abstract RegularFileProperty getInputSpec()

        The local OpenAPI 2.0/3.x specification file to validate.

        Use remoteInputSpec instead when validating a spec hosted at a URL.

      • getRecommend

        @Optional()@Input() abstract Property<Boolean> getRecommend()

        Whether to include recommendations in the validation output. Defaults to true.

        Recommendations are advisory hints about spec quality that do not cause the task to fail.

      • getTreatWarningsAsErrors

        @Optional()@Input() abstract Property<Boolean> getTreatWarningsAsErrors()

        When true, the task fails if the spec produces validation warnings. Defaults to false.

      • set

         final Unit set(RegularFileProperty $self, String path)

        Extension function to allow setting inputSpec with a String path in Kotlin DSL. Example: inputSpec.set("$rootDir/api.yaml")

      • setInputSpecAsString

         final Unit setInputSpecAsString(String path)

        Groovy-compatible setter for inputSpec property. Accepts a String and automatically routes to remote or local file based on URI detection. Clears the opposite property to prevent stale values from taking precedence.