Skip to content

zierler-f/YAML-Validator-Plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAML Validator Plugin

Introduction

The YAML Validator Plugin was designed to help you find errors in your YAML files, before your program reaches development stages. This way annoying YAML errors during program startup can be prevented.

Installation

Gradle 1.x and 2.0

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.at.zierler:yaml-validator-plugin:1.5.0"
  }
}

apply plugin: "at.zierler.yamlvalidator"

Gradle 2.1 and higher

plugins {
  id "at.zierler.yamlvalidator" version "1.5.0"
}

Usage

After including the plugin in your build.gradle like above, the YAML check can be run with: gradle validateYaml.

Check task

When the java plugin, or any other plugin which introduces a check task, is included the validateYaml task will automatically run during the check task.

Automatically run during other tasks

To run the validateYaml automatically during a task other than check, you can add the following to your build.gradle:

<any-existing-task>.dependsOn validateYaml

Configuration

The following are all possible configuration options:

Name Default value Description
searchPaths ['src/main/resources/'] Array of all directories which should be searched for YAML files, or direct paths to single YAML files.
allowDuplicates false Allow YAML files, which contain a duplicate key when checking.
searchRecursive false Search directories defined in `searchPaths` recursively.

Those are the configuration options, as in an build.gradle file, with their default values:

yamlValidator {
    searchPaths = ['src/main/resources/']
    allowDuplicates = false
    searchRecursive = false
}

Logging

All messages are logged in logging level INFO and higher by default. To see all outputs please use: gradle validateYaml --info.

Releases

No releases published

Packages

No packages published

Languages