File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,3 +41,31 @@ def geographies_schema():
4141
4242 return common .check_schema (schema )
4343
44+
45+ def schema_generators ():
46+ """
47+ The dict of schema generators for Geography.
48+
49+ The key is the name of the schema file/template file.
50+ The value is the generator function, taking a dict of common definitions as an argument.
51+ The generator function should return the complete, validated schema document as a dict.
52+ """
53+ return {
54+ "geography" : geography_schema ,
55+ "geographies" : geographies_schema
56+ }
57+
58+
59+ def write_schema_files ():
60+ """
61+ Create each of the Geography endpoint schema files in the appropriate directory.
62+ """
63+ print ("\n Starting to generate Geography JSON Schemas...\n " )
64+
65+ for name , generator in schema_generators ().items ():
66+ schema = generator ()
67+ with open (f"../geography/{ name } .json" , "w" ) as schemafile :
68+ schemafile .write (json .dumps (schema , indent = 2 ))
69+ print (f"Wrote { name } .json" )
70+
71+ print ("\n Finished generating Geography JSON Schemas" )
You can’t perform that action at this time.
0 commit comments