Rules
Semantic Version
Validate semantic version strings (semver.org).
Use semver() on string fields to require a valid semantic version.
Teki schema = Teki.fromRules(
string("version").required().semver()
);Follows the semver.org specification. Pre-release labels and build metadata are accepted.
| Value | Valid |
|---|---|
1.0.0 | yes |
2.3.1-alpha.1 | yes |
1.0.0-rc.1+build.123 | yes |
v1.0.0 | no — v prefix not allowed |
1.0 | no — missing patch segment |
01.0.0 | no — leading zero |
Available on
string(...)
Annotation equivalent
import dev.ditsche.teki.annotation.SemVer;
public class ReleaseRequest {
@Required
@SemVer
private String version;
}