有没有办法从C#类以编程方式生成JSON模式?
Something which we can do manually using http://www.jsonschema.net/
有没有办法从C#类以编程方式生成JSON模式?
Something which we can do manually using http://www.jsonschema.net/
Another option which supports generating JSON Schema v4 is NJsonSchema:
var schema = JsonSchema.FromType<Person>();
var schemaJson = schema.ToJson();
The library can be installed via NuGet.
Update for NJsonSchema v9.4.3+:
using NJsonSchema;
var schema = await JsonSchema.FromTypeAsync<Person>();
var schemaJson = schema.ToJson();