-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f9c6036
commit edbfc0d
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 | ||
|
||
COPY . /app | ||
RUN dotnet tool install --global Corvus.Json.JsonSchema.TypeGeneratorTool --version 3.1.1 | ||
ENTRYPOINT ["/app/generate-and-run.sh"] | ||
CMD [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Corvus.Json; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
|
||
// Read and parse all instances | ||
var lines = File.ReadLines(args[0]); | ||
var docs = lines.Select(l => JSB.Schema.Parse(l)); | ||
|
||
Stopwatch stopWatch = new Stopwatch(); | ||
stopWatch.Start(); | ||
|
||
// Loop and validate all instances | ||
var valid = true; | ||
foreach (var doc in docs) { | ||
var result = doc.Validate(ValidationContext.ValidContext, ValidationLevel.Flag); | ||
valid = valid && result.IsValid; | ||
} | ||
|
||
stopWatch.Stop(); | ||
TimeSpan ts = stopWatch.Elapsed; | ||
|
||
// Output file time and exit | ||
Console.WriteLine(ts.TotalNanoseconds); | ||
Environment.Exit(valid ? 0 : 1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Corvus.Json.ExtendedTypes" Version="3.1.1" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
SCHEMA=$1 | ||
INSTANCES=$2 | ||
|
||
~/.dotnet/tools/generatejsonschematypes --rootNamespace JSB --rootPath='#' --useSchema Draft4 --outputPath /app "$1" > /dev/null | ||
|
||
cd app | ||
dotnet build --configuration=Release > /dev/null || exit 1 | ||
rm -f Schema*.cs | ||
/app/bin/Release/net8.0/bench "$2" | ||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -o errexit | ||
set -o nounset | ||
|
||
grep -Eo '\--version .*$' implementations/corvus/Dockerfile | cut -d' ' -f2 |