Files
flatbuffers/tests/monster_test.schema.json
schoetbi f20204180d Json schema (#4369)
* Added empty generator for json schema (idl_gen_json_schema.cpp)
#4360

* JsonSchemaGenerator: output of tables implemented

current problems:
- typenames are not correct
- array types need to be deduced

#4360

* JsonSchemaGenerator: Corrected generation of typenames
Current problems: enum types not written correctly
#4360

* JsonSchemaGenerator: Added generation of enum types
#4360

* idl_gen_json_schema.cpp: Write required properties to schema
#4360

* idl_gen_json_schema.cpp: Export Types including namespace
#4360

* idl_gen_json_schema.cpp: Fixed Json format
#4360

* idl_gen_json_schema.cpp: Formatted according to google code style
#4360

* Checked in monster_test.bfbs with changes from master

* Added idl_gen_json_schema.cpp in CMakeLists.txt

* generate_code.bat: Added generation of json schema

* Added todo.md

* generate_code.sh: Added generation of json schema

* Addressed some review issues
- removed command line arg -S
- removed new lines
- fixed codestyle in template functions
- removed usage of stringstream
- idented json schema
#4360

* removed auto in idl_gen_json_schema.cpp

* idl_gen_json_schema.cpp: changed iterator declarations to auto
#4360

* deleted todo.md

* idl_gen_json_schema.cpp: Removed keyword "override" so that vs2010 can compile

* idl_gen_json_schema.cpp: switch statement in GenType handeles all enum-members

* idl_gen_json_schema.cpp: Removed cerr output

* idl_gen_json_schema.cpp: Avoid vector copying

* idl_gen_json_schema.cpp: Fixed identation of json schema output

* idl_gen_json_schema.cpp: Do not output empty descriptions
2017-07-10 08:05:59 -07:00

106 lines
4.0 KiB
JSON

{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"MyGame_OtherNameSpace_FromInclude" : {
"type" : "string",
"enum": ["IncludeVal"]
},
"MyGame_Example_Color" : {
"type" : "string",
"enum": ["Red", "Green", "Blue"]
},
"MyGame_Example_Any" : {
"type" : "string",
"enum": ["NONE", "Monster", "TestSimpleTableWithEnum", "MyGame_Example2_Monster"]
},
"MyGame_OtherNameSpace_Unused" : {
"type" : "object",
"properties" : {
}
},
"MyGame_Example2_Monster" : {
"type" : "object",
"properties" : {
}
},
"MyGame_Example_Test" : {
"type" : "object",
"properties" : {
"a" : { "type" : "number" },
"b" : { "type" : "number" }
}
},
"MyGame_Example_TestSimpleTableWithEnum" : {
"type" : "object",
"properties" : {
"color" : { "$ref" : "#/definitions/MyGame_Example_Color" }
}
},
"MyGame_Example_Vec3" : {
"type" : "object",
"properties" : {
"x" : { "type" : "number" },
"y" : { "type" : "number" },
"z" : { "type" : "number" },
"test1" : { "type" : "number" },
"test2" : { "$ref" : "#/definitions/MyGame_Example_Color" },
"test3" : { "$ref" : "#/definitions/MyGame_Example_Test" }
}
},
"MyGame_Example_Ability" : {
"type" : "object",
"properties" : {
"id" : { "type" : "number" },
"distance" : { "type" : "number" }
}
},
"MyGame_Example_Stat" : {
"type" : "object",
"properties" : {
"id" : { "type" : "string" },
"val" : { "type" : "number" },
"count" : { "type" : "number" }
}
},
"MyGame_Example_Monster" : {
"type" : "object",
"description" : " an example documentation comment: monster object",
"properties" : {
"pos" : { "$ref" : "#/definitions/MyGame_Example_Vec3" },
"mana" : { "type" : "number" },
"hp" : { "type" : "number" },
"name" : { "type" : "string" },
"friendly" : { "type" : "boolean" },
"inventory" : { "type" : "array", "items" : { "type" : "number" } },
"color" : { "$ref" : "#/definitions/MyGame_Example_Color" },
"test_type" : { "$ref" : "#/definitions/MyGame_Example_Any" },
"test" : { "anyOf": [{ "$ref" : "#/definitions/MyGame_Example_Monster" },{ "$ref" : "#/definitions/MyGame_Example_TestSimpleTableWithEnum" },{ "$ref" : "#/definitions/MyGame_Example2_Monster" }] },
"test4" : { "type" : "array", "items" : { "$ref" : "#/definitions/MyGame_Example_Test" } },
"testarrayofstring" : { "type" : "array", "items" : { "type" : "string" } },
"testarrayoftables" : { "type" : "array", "items" : { "$ref" : "#/definitions/MyGame_Example_Monster" } },
"enemy" : { "$ref" : "#/definitions/MyGame_Example_Monster" },
"testnestedflatbuffer" : { "type" : "array", "items" : { "type" : "number" } },
"testempty" : { "$ref" : "#/definitions/MyGame_Example_Stat" },
"testbool" : { "type" : "boolean" },
"testhashs32_fnv1" : { "type" : "number" },
"testhashu32_fnv1" : { "type" : "number" },
"testhashs64_fnv1" : { "type" : "number" },
"testhashu64_fnv1" : { "type" : "number" },
"testhashs32_fnv1a" : { "type" : "number" },
"testhashu32_fnv1a" : { "type" : "number" },
"testhashs64_fnv1a" : { "type" : "number" },
"testhashu64_fnv1a" : { "type" : "number" },
"testarrayofbools" : { "type" : "array", "items" : { "type" : "boolean" } },
"testf" : { "type" : "number" },
"testf2" : { "type" : "number" },
"testf3" : { "type" : "number" },
"testarrayofstring2" : { "type" : "array", "items" : { "type" : "string" } },
"testarrayofsortedstruct" : { "type" : "array", "items" : { "$ref" : "#/definitions/MyGame_Example_Ability" } },
"flex" : { "type" : "array", "items" : { "type" : "number" } }
},
"required" : [ "name"]
}
},
"$ref" : "#/definitions/MyGame_Example_Monster"
}