Skip to content

Commit 445dfd3

Browse files
committed
- Add badges to readme.
- Add examples project with Vogen extension example.
1 parent 688de7b commit 445dfd3

File tree

9 files changed

+88
-5
lines changed

9 files changed

+88
-5
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: CodingFlow

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/pull-request.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: pull-request-unit-tests
2+
run-name: Unit tests
3+
on: [push, workflow_dispatch]
4+
jobs:
5+
build:
6+
name: Unit tests
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
dotnet-version: ["10.0.x"]
11+
12+
steps:
13+
- uses: actions/checkout@v6
14+
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
15+
uses: actions/setup-dotnet@v5
16+
with:
17+
dotnet-version: ${{ matrix.dotnet-version }}
18+
- name: Install dependencies
19+
run: dotnet restore
20+
- name: Build
21+
run: dotnet build --configuration Release --no-restore
22+
- name: Test
23+
run: dotnet test --no-restore --verbosity normal

CodingFlow.FluentValidation.VogenExtensions.UnitTests/CodingFlow.FluentValidation.VogenExtensions.UnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageReference Include="NUnit" Version="4.3.2" />
1616
<PackageReference Include="NUnit.Analyzers" Version="4.7.0" />
1717
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
18+
<PackageReference Include="Vogen" Version="8.0.4" />
1819
</ItemGroup>
1920

2021
<ItemGroup>

CodingFlow.FluentValidation.VogenExtensions/CodingFlow.FluentValidation.VogenExtensions.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
1313
<RepositoryUrl>https://github.com/CodingFlow/fluent-validation</RepositoryUrl>
1414
<PackageTags>fluent;validation;vogen</PackageTags>
15-
<PackageReleaseNotes>
16-
0.1.0
17-
Initial release.
18-
</PackageReleaseNotes>
15+
<PackageReleaseNotes>0.1.0
16+
Initial release.</PackageReleaseNotes>
1917
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
2018
<Authors>Coding Flow</Authors>
2119
</PropertyGroup>

CodingFlow.FluentValidation.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
<Project Path="CodingFlow.FluentValidation.VogenExtensions.UnitTests/CodingFlow.FluentValidation.VogenExtensions.UnitTests.csproj" />
44
<Project Path="CodingFlow.FluentValidation.VogenExtensions/CodingFlow.FluentValidation.VogenExtensions.csproj" />
55
<Project Path="CodingFlow.FluentValidation/CodingFlow.FluentValidation.csproj" />
6+
<Project Path="Examples/Examples.csproj" Id="31b76e57-988c-453b-b235-e2a4a4f43642" />
67
</Solution>

Examples/Examples.csproj

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net10.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\CodingFlow.FluentValidation.VogenExtensions\CodingFlow.FluentValidation.VogenExtensions.csproj" />
11+
</ItemGroup>
12+
13+
</Project>

Examples/VogenExamples/Age.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using CodingFlow.FluentValidation.Validators;
2+
using CodingFlow.FluentValidation.VogenExtensions;
3+
using Vogen;
4+
using static CodingFlow.FluentValidation.Validations;
5+
6+
namespace Examples;
7+
8+
[ValueObject]
9+
public readonly partial struct Age
10+
{
11+
public static Validation Validate(int value)
12+
{
13+
return RuleFor(value)
14+
.BetweenInclusive(0, 200)
15+
.VogenResult();
16+
}
17+
}

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# CodingFlow Fluent Validation
2+
23
Minimal, easy to use fluent validations API inspired by [FluentValidation](https://github.com/FluentValidation/FluentValidation).
34

5+
[![Nuget](https://img.shields.io/nuget/v/CodingFlow.FluentValidation)](https://www.nuget.org/packages/CodingFlow.FluentValidation)
6+
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/CodingFlow/options-bindings-generator/pull-request.yml)
7+
[![Nuget](https://img.shields.io/nuget/dt/CodingFlow.FluentValidation)](https://www.nuget.org/packages/CodingFlow.FluentValidation)
8+
[![GitHub Sponsors](https://img.shields.io/github/sponsors/CodingFlow)](https://github.com/sponsors/CodingFlow)
9+
410
When you need to validate any type, even primitives in an easy and direct way, this library fits the bill. FluentValidation by Jeremy Skinner requires creating a separate validator class to register validation rules, and then instantiating the validator class. This library on the other hand, let's you add validation directly.
511

612
# Usage
@@ -29,4 +35,21 @@ var errors = result.Errors;
2935

3036
## Vogen
3137

32-
Install the Vogen extensions nuget package, `CodingFlow.FluentValidation.VogenExtensions`
38+
Extensions to integrate with Vogen validation methods.
39+
40+
To get started, install the Vogen extensions nuget package, `CodingFlow.FluentValidation.VogenExtensions`.
41+
42+
To get the final result of the fluent validation chain, call `VogenResult()` instead of `Result()`:
43+
44+
```csharp
45+
[ValueObject]
46+
public readonly partial struct Age
47+
{
48+
public static Validation Validate(int value)
49+
{
50+
return RuleFor(value)
51+
.BetweenInclusive(0, 200)
52+
.VogenResult();
53+
}
54+
}
55+
```

0 commit comments

Comments
 (0)