Json Schema Generation in Native AoT
Documentation
- [x] I have consulted the documentation, and my question isn't answered there.
Nuget Package
JsonSchema.Net.Generation
Package Version
5.0.3
How can I help? Please provide as much context as possible.
I've been using .NET GetJsonSchemaAsNode() method in AOT context however it doesn't have attributes to specify other validation attributes. I came across this library and wanted to use it since it seemed to have the extra validation and JSON schema metadata.
In the docs it mentions that JSON schema generation does not work in the AOT context. However, I ran across some older PRs in the repo which mention AOT support so was wondering if JSON schema is also supported in that context.
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Most of the libraries in this project are AOT compatible, but the schema generation library is not. It uses a lot of reflection to do its job.
I currently have no plans to update it to include AOT support since it would be a pretty much a complete rewrite.
Thanks for the info. I'm still quite new to AOT and Json Schemas as a whole. Is it possible to generate the JSON schema in a build step and then embed the JSON schema string inside the AOT application to be used by the Evaluate() method?
Yeah, I'm not fully up on AOT either. I was fortunate to have some very smart people at .Net help.
Absolutely you can create the schema in an initial build step. You'd then just load the schema at runtime using the static .FromText() method.