-
Notifications
You must be signed in to change notification settings - Fork 3
/
Program.cs
25 lines (21 loc) · 885 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using NJsonSchema;
using NJsonSchema.CodeGeneration.CSharp;
// schema sources:
// - https://geoparquet.org/releases/v1.0.0/schema.json
var json = File.ReadAllText("./1.0.0/schema.json");
// there are two manual actions :-(
//
// 1] remove crs from schema because too complex
// "crs": {
// "oneOf": [
// { "$ref": "https://proj.org/schemas/v0.5/projjson.schema.json" },
// { "type": "null" }
// ]
// },
// 2] Change in resulting file GeoParquet.cs - Rename object Anonymous to GeoColumn
var schema = await JsonSchema.FromJsonAsync(json);
var settings = new CSharpGeneratorSettings() { JsonLibrary = CSharpJsonLibrary.SystemTextJson };
settings.Namespace = "GeoParquet";
var generator = new CSharpGenerator(schema, settings);
var file = generator.GenerateFile();
File.WriteAllText("../../../../src/GeoParquet.cs", file);