jakartaee / validation-spec

Jakarta Validation spec document
http://beanvalidation.org
Apache License 2.0
20 stars 22 forks source link

Jakarta Validation specification

This repository contains the Jakarta Validation specification. For more information on Jakarta Validation and the work in progress, go to https://beanvalidation.org.

Building docs

The specification is written in the AsciiDoc format. In order to convert this into nicely rendered output, you need to have Apache Ant installed on your system and available on your classpath. The build file build.xml is located in this directory and all commands are relative to this directory.

The pom.xml in the root directory is an in-progress migration to build with maven. It can be run with mvn clean package, however Ant is still currently the official build method.

Tagging phrases for the TCK

The Jakarta Validation TCK is a suite of unit tests for validating the compliance of Jakarta Validation implementations with the specification.

The tests of the TCK are based on assertions representing sentences and phrases in this specification. Labels on specific text elements of the specification are used to mark those which should lead to an assertion in the TCK. The following values are allowed:

Updating the TCK audit file

The TCK audit file is an XML file containing all assertions of the TCK. This file is generated with help of an XSL transformation (for that purpose the spec is converted into DocBook).

The generation is executed by running ant create-tck-audit-file. This is required whenever tagged elements have been added, updated, removed or changed their position within all tagged elements of a section.

The generated file target/tck-audit.xml should not be re-formatted and must be checked into the TCK project. If an update changed the section numbers of existing assertions, the corresponding tests need to be adapted as well since they reference the section numbers in the @SpecAssertion annotation.

Contributing to the specification

By submitting a "pull request" or otherwise contributing to this repository, you agree to license your contribution under the Apache Software License 2.0.

The recommended approach to contribute to the spec is via GitHub pull requests. More on contribution at http://beanvalidation.org/contribute/

Make sure to not go beyond 80 columns per line.

Style rules

Here is an example

/**
 * Returns the complementary elements related to {@link FooBar#baz()}.
 * This allows to break things apart.
 * <p/>
 * Demolition mileage may vary depending on the robustness
 * of {@code FooBar} when using {@code List}:
 * <ul>
 *     <li>This is a beginning</li>
 *     <li>This is the end</li>
 * </ul>
 * <pre>
 * Some code = new Some();
 * if (size >12) {
 *     code.doStuff();
 * }
 * </pre>
 *
 * @param test this is a long description that needs
 *        to be done on several lines, yep
 * @param foo this is another param
 * @return the result
 * @throws IllegalArgumentException when things happen
 *
 * @since 1.1
 * @deprecated
 */
public void someMethod() {
    User user = [...];
    [...]
}

/**
 * Welcome to this element related to {@link FooBar}.
 * This allowed to break things apart.
 * <p/>
 * Demolition mileage may vary depending on the robustness
 * of {@code FooBar} when using {@code List}
 *
 * @author Emmanuel Bernard
 * @since 1.1
 * @deprecated
 */
public class GoodStuff {

    /**
     * [...]
     */
    [...]
}

For the API, in particular the JavaDoc, follow the conventions described at http://hibernate.org/validator/contribute/#coding-guidelines.

Showing tck assertion coverage

You can update the file docinfo/index-docinfo.html to show what is covered and what is not covered by the TCK assertion coverage.