private void GenerateSchema(DirectoryInfo dir, Type type, Action <JsonSchema> act = null) { string id = this._parent.Config.GetUri(type.Name); string filename = System.IO.Path.Combine(dir.FullName, type.Name + extension); var schema = SchemaHelper.GenerateSchemaForClass(type, type.Name); schema.AllowAdditionalProperties = true; schema.Id = id; if (act != null) { act(schema); } var payload = schema.ToJson(); string old = null; if (File.Exists(filename)) { old = filename.LoadContentFromFile(); } if (old == null || string.Compare(old, payload) != 0) { if (File.Exists(filename)) { File.Delete(filename); } filename.Save(payload); _parent.Diagnostic.Append(new DiagnositcMessage() { Severity = SeverityEnum.Verbose, File = filename, Text = $"File {filename} is refreshed", }); } }