Project to allow for schema generation from a "published" DLL.
The SchemaGenerator is a dotnet tool to inspect a built DLL (Assembly) and extract all the exported types, optionally supplying a namespace filter.
This generator uses this project under the hood and furthermore use the System.Text.Json package by default - currently unable to override this.
For details about System.Text.Json see this part of the documentation.
To get the most reliable schema output use the annotations to their fullest including setting examples in the XML tags which can then be exported/used by setting the following property in the csproj file.
To see the list of all options run
schemagenerator --help
In the root of the repo run the following command to generate the binary.
make NETCORE_TARGET_ARCH=win-x64|osx-x64|osx-arm64 build_schemagen
./dist/[osx-x64|win-x64]/schemagenerator --help
schemagenerator -p path/to/publish/Dll.dll -f Filter.This.Namespace.Only -d -o output/dir
when running locally against a target - run
dotnet publish
in the target project to ensure all the dependency DLLs are present in the same directory, else assemblyLoader will fail if types are referencing packages from other assemblies.
Actual example against the domain.foo
repo
First publish the domain.foo.Models
project:
dotnet publish /your/git/path/to/domain.foo/src/domain.foo.Models/domain.foo.Models.csproj -c Release
Once done we can then generate the output.
schemagenerator -p /your/git/path/to/domain.foo/src/domain.foo.Models/bin/Release/net6.0/publish/domain.foo.Models.dll -f domain.foo.Models.Events.Version1 -d
By default the output is generated in the current directory creating a folder .autogened
which will include both the samples and schemas.
NOTE: Samples are using the null type on a complex object type as opposed the typed object.