From e5b8aeeda727f0fcbaa6f9e72b5b2ed3e4a2dd3c Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 24 May 2022 19:45:59 -0400 Subject: [PATCH] Add `$schema` property to schema generation --- SchemaExporter/SchemaExporter.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SchemaExporter/SchemaExporter.cs b/SchemaExporter/SchemaExporter.cs index 550b3eb5..f58241a6 100644 --- a/SchemaExporter/SchemaExporter.cs +++ b/SchemaExporter/SchemaExporter.cs @@ -62,6 +62,12 @@ public static class SchemaExporter { var schema = JsonSchema.FromType(_generatorSettings); schema.Title = _title; + var schemaLinkProp = new JsonSchemaProperty + { + Type = JsonObjectType.String, + Description = "The schema to validate with" + }; + schema.Properties.Add("$schema", schemaLinkProp); schema.ExtensionData ??= new Dictionary(); schema.ExtensionData.Add("$docs", new Dictionary {