mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
remove unneeded reflection schema stuff (for now)
This commit is contained in:
parent
27f486bb78
commit
5b41465266
1 changed files with 3 additions and 16 deletions
|
|
@ -1,8 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using FilterLists.Data.Models.Implementations;
|
||||
using Newtonsoft.Json.Schema.Generation;
|
||||
|
||||
|
|
@ -12,24 +9,14 @@ public static class JsonSchemaGenerator
|
|||
{
|
||||
public static void WriteSchemaToFiles()
|
||||
{
|
||||
foreach (var type in GetTypesInNamespace(Assembly.GetExecutingAssembly(),
|
||||
"FilterLists.Data.Models.Implementations"))
|
||||
{
|
||||
if (type != typeof(List)) continue; //TEMP: only document List schema for now
|
||||
WriteSchemaToFile(type);
|
||||
}
|
||||
WriteSchemaToFile(typeof(List));
|
||||
}
|
||||
|
||||
private static void WriteSchemaToFile(Type type)
|
||||
{
|
||||
File.WriteAllText(
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory + @"\", @"..\..\..\..\..\data\")) +
|
||||
type.Name + "Schema.json", new JSchemaGenerator().Generate(type).ToString());
|
||||
}
|
||||
|
||||
private static IEnumerable<Type> GetTypesInNamespace(Assembly assembly, string @namespace)
|
||||
{
|
||||
return assembly.GetTypes().Where(t => string.Equals(t.Namespace, @namespace, StringComparison.Ordinal));
|
||||
Path.GetFullPath(Path.Combine(AppContext.BaseDirectory + @"\", @"..\..\..\..\..\data\")) + type.Name +
|
||||
"Schema.json", new JSchemaGenerator().Generate(type).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue