https://github.com/arasdenizhan/slim-validator
Lightweight annotation-based validation library for Java with zero dependencies.
https://github.com/arasdenizhan/slim-validator
annotations java library open-source validation
Last synced: 6 months ago
JSON representation
Lightweight annotation-based validation library for Java with zero dependencies.
- Host: GitHub
- URL: https://github.com/arasdenizhan/slim-validator
- Owner: arasdenizhan
- License: apache-2.0
- Created: 2025-07-04T10:59:38.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-08-25T20:48:47.000Z (10 months ago)
- Last Synced: 2025-08-25T21:33:35.476Z (10 months ago)
- Topics: annotations, java, library, open-source, validation
- Language: Java
- Homepage: https://central.sonatype.com/artifact/io.github.arasdenizhan/slim-validator
- Size: 12.2 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slim-validator

[](https://github.com/arasdenizhan/slim-validator/blob/master/LICENSE)
[](https://github.com/arasdenizhan/slim-validator/releases/tag/1.2.0)
[](https://central.sonatype.com/artifact/io.github.arasdenizhan/slim-validator)

**A lightweight, annotation-driven Java validation library with zero dependencies.**
Easily validate your POJOs using simple annotations like `@NotNull`, `@Min`, `@Max`, `@Pattern`, `@Email`, and `@Length`.
More features will be integrated soon.
---
## 🚀 Features
- **Annotation-based validation** — simple and clear
- Supported annotations:
- `@NotNull` — null check
- `@Min` / `@Max` — numeric boundaries
- `@Pattern` — regex pattern validation
- `@Email` — email format validation
- `@Length` — string length constraints
- `@NotBlank` — string null, empty and only whitespace check
- `@Past` and `@Future` — date check
- **Performance optimized** — reflection access is cached
- **Easy integration** — just annotate your POJOs and call the validator
- **Open source** — community-driven and extendable
---
## 💡 Usage
### 1. Define your POJO
```java
public class UserDto {
@NotNull(message = "Email cannot be null")
@Email(message = "Email format is invalid")
private String email;
@Min(value = 18, message = "Age must be at least 18")
@Max(value = 99, message = "Age must be less than 100")
private Integer age;
@Length(min = 2, max = 3, message = "Country code length must be between 2 and 3")
private String countryCode;
// getters and setters
}
```
### 2. Validate your object
```java
SlimValidator validator = new SlimValidator();
UserDto userDto = new UserDto();
userDto.setAge(12);
userDto.setCountryCode("US");
userDto.setEmail("email@example.com");
validator.validate(userDto); // throws ValidationException on failure
```
---
## 📦 Central Repository
- Maven (Latest Version)
```xml
io.github.arasdenizhan
slim-validator
1.2.0
```
- Gradle (Latest Version)
```
implementation group: 'io.github.arasdenizhan', name: 'slim-validator', version: '1.2.0'
```
---
## 🛠️ Development
- Easily add new annotations and validation strategies
- Extensible architecture based on `StrategyFactory`
- Reflection caching for optimal performance
---
## 📚 Documentation
The full API documentation is available at:
👉 [Javadoc for Slim Validator](https://arasdenizhan.github.io/slim-validator/)
---
## 📚 Benchmark Chart

---
## 📄 License
Apache License 2.0 (Open source and free to use)
---
## 🤝 Contribution
Pull requests and issues are welcome!
---
## Contact
Denizhan Aras — [github.com/arasdenizhan](https://github.com/arasdenizhan)