Chisle
코딩 에이전트 플러그인, 20개 실시간 작업에서 기본 모델 52% 활용, 간결한 페르소나와 출력 압축 제공
저장소 정보는 아직 수집하지 않았습니다.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
메이커가 쓴 소개는 위의 한 줄이 전부입니다. 더 자세한 내용은 저장소 README에서 읽을 수 있습니다. 저장소 README ↗
README 전체를 불러오는 중입니다.
README 전문 보기 ↗YAVI (pronounced jɑ-vάɪ) is a lambda based type safe validation for Java.
YAVI sounds as same as a Japanese slang "YABAI (ヤバイ)" that means awesome or awful depending on the context (like "Crazy"). If you use YAVI, you will surely understand that it means the former.
The concepts are
If you are not a fan of Bean Validation, YAVI will be an awesome alternative.
YAVI has the following features:
See the reference documentation for details.
This content is derived from https://hibernate.org/validator/documentation/getting-started/
Welcome to YAVI.
The following paragraphs will guide you through the initial steps required to integrate YAVI into your application.
This guide uses the API of YAVI 0.18.0, which is not released yet. In order to use its snapshot within a Maven project, add the following dependency and repository to
your pom.xml:
<dependency>
<groupId>am.ik.yavi</groupId>
<artifactId>yavi</artifactId>
<version>0.18.0-SNAPSHOT</version>
</dependency>
<repositories>
<repository>
<id>central-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
The latest release is 0.17.3; see the reference documentation for its API.
This tutorial uses JUnit and AssertJ. Add the following dependencies as needed:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>6.1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.27.7</version>
<scope>test</scope>
</dependency>
YAVI validates in two styles. Choose by what you have in hand when validation starts:
| You have | You want | Use |
|---|---|---|
Input that is not an object yet: a Map, a parsed JSON document, request parameters | To validate it and then create the object, so that an invalid object never exists | Yavi.schema() ... fromMap(...) |
| An object that is already created, as with Bean Validation | The "classic" style: to check the object and get its violations | ValidatorBuilder |
Yavi.schema() describes the properties of an input, and fromMap ends it with a validator that reads them from a Map<String, Object> by their names, checks their types and gives them to a constructor. The object is created only when every property is valid.
Create src/main/java/com/example/Car.java and write the following code.
package com.example;
import am.ik.yavi.input.ObjectInputValidator;
import am.ik.yavi.validator.Yavi;
public record Car(String manufacturer, String licensePlate, Integer seatCount) {
public static final ObjectInputValidator<Car> validator = Yavi.schema()
._string("manufacturer")
._string("licensePlate", c -> c.greaterThanOrEqual(2).lessThanOrEqual(14))
._integer("seatCount", c -> c.greaterThanOrEqual(2))
.fromMap(Car::new);
}
Each method of the schema declares a property with its type, its name and its constraints:
manufacturer must be a stringlicensePlate must be a string that is between 2 and 14 characters longseatCount must be an integer that is at least 2A property is required: an absent key is reported with object.required ("manufacturer" is required) and null with object.notNull ("manufacturer" must not be null), so notNull() need not be written and the constructor is never given null. A property that may be null says so with nullable() or optional(), as described below.
To perform a validation, give a map to the validator. To demonstrate this, let’s have a look at a simple unit test:
Create src/test/java/com/example/CarTest.java and write the following code.
여기까지가 README 앞부분입니다. 나머지는 원문에서 읽을 수 있습니다. README 전문 보기 ↗