Contributing
Contributing
Section titled “Contributing”Contributions are welcome. Please open an issue or pull request against purview-dev/zodsharp.
Repository layout
Section titled “Repository layout”src/ src/ ZodSharp/ Core validation library + JSON Schema export (Z.ToJsonSchema) SourceGenerators/ Compile-time [ZodSchema] generator (netstandard2.0, Roslyn) SystemTextJson/ System.Text.Json integration + JSON Schema import NewtonsoftJson/ Newtonsoft.Json integration + JSON Schema import AspNetCore/ ASP.NET Core ProblemDetails integration Examples.CLI/ Usage examples Benchmarks/ BenchmarkDotNet performance suite tests/ *.UnitTests/ TUnit test projectssrc/ts/ TypeScript (Zod) schema + fixture generationtests/ts/ Vitest cross-platform testsdocs/wiki/ This documentation suiteCommands
Section titled “Commands”just build # dotnet build src/ZodSharp.slnx -c Debugjust test # dotnet test src/ZodSharp.slnx -c Debug --treenode-filter "/*/*/*/*"just lint-check # dotnet csharpier check .just lint-fix # dotnet csharpier format .just pack # dotnet pack src/ZodSharp.slnx -c Debug -o artifactsjust perf-tests # dotnet run --project src/src/Benchmarks/Benchmarks.csproj -c ReleaseTypeScript tooling uses Bun:
bun installbun run test # vitest run (cross-platform TS tests)bun run generate-fixtures # regenerates src/ts/fixtures/*.json from ZodTesting bar
Section titled “Testing bar”- Framework: TUnit.
[Test]methods take aCancellationToken cancellationTokenparameter where relevant.- Use
// Arrange,// Act,// Assertcomments. - Use meaningful, descriptive names (
Action_GivenCondition_ExpectedResult). - Treat work as incomplete until the relevant tests pass.
For source generator tests, use the Purview.SourceGeneratorFramework.Testing.TUnit base classes (TUnitSourceGeneratorTestBase, TUnitDiagnosticAnalyzerTestBase) and assert with CodeQuery; test incrementally, not just generated text.
Documentation
Section titled “Documentation”This wiki lives in docs/wiki/. The site build (purview-dev Astro/Starlight) pulls these files via github-path sync and rewrites relative .md links into site routes.
Conventions:
_Sidebar.mddeclares page order (parsed by the sync, never rendered).- Every page starts with a single
#heading (the page title) followed by a one-paragraph description. - Link to other pages with relative
.mdlinks:[Getting Started](../getting-started/). - GitHub alert blockquotes (
> [!NOTE],> [!TIP],> [!WARNING],> [!CAUTION],> [!IMPORTANT]) are converted to Starlight asides. - Relative repository-path links (e.g.
src/src/ZodSharp/Z.cs) are rewritten to GitHub blob URLs automatically. - Keep the
CrossPlatformUserSchema(C#) andUserSchema(TypeScript) in sync when either changes.
Formatting
Section titled “Formatting”Formatting is enforced with CSharpier. .editorconfig at the repo root defines style (tabs for code, 2-space for XML/JSON/YAML/markdown).