Tool for automatically generating YAML / JSON serialization classes and constructor operators from schema files.
-
Navigate to the Bonsai.Sgen NuGet tool package
-
Click
.NET CLI (Local)
and copy the two suggested commands. E.g.:dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local Bonsai.Sgen
-
To view the tool help reference documentation, run:
dotnet bonsai.sgen --help
-
To generate YAML serialization classes from a schema file:
dotnet bonsai.sgen --schema schema.json --serializer YamlDotNet
-
To generate JSON serialization classes from a schema file:
dotnet bonsai.sgen --schema schema.json --serializer NewtonsoftJson
-
Copy the generated class file to your project
Extensions
folder. -
Add the necessary package references to your
Extensions.csproj
file. For example:<ItemGroup> <PackageReference Include="Bonsai.Core" Version="2.8.0" /> <PackageReference Include="YamlDotNet" Version="13.7.1" /> </ItemGroup> </Project>
-
To restore the tool at any point, run:
dotnet tool restore