mirror of
https://github.com/google/flatbuffers.git
synced 2026-07-05 14:57:06 +00:00
JSON schema - tailing double quotes for maximum (#6452)
* Fix C/C++ Create<Type>Direct with sorted vectors If a struct has a key the vector has to be sorted. To sort the vector you can't use "const". * Changes due to code review * Improve code readability * Add generate of JSON schema to string to lib * option indent_step is supported * Remove unused variables * Fix break in test * Fix style to be consistent with rest of the code * Fix double quotes for (u)int8 in json schema * Fix reference file for JSON schema test * Fix reference file for JSON schema test
This commit is contained in:
@@ -49,10 +49,10 @@ std::string GenType(BaseType type) {
|
|||||||
return "\"type\" : \"integer\", \"minimum\" : " +
|
return "\"type\" : \"integer\", \"minimum\" : " +
|
||||||
NumToString(std::numeric_limits<int8_t>::min()) +
|
NumToString(std::numeric_limits<int8_t>::min()) +
|
||||||
", \"maximum\" : " +
|
", \"maximum\" : " +
|
||||||
NumToString(std::numeric_limits<int8_t>::max()) + "\"";
|
NumToString(std::numeric_limits<int8_t>::max());
|
||||||
case BASE_TYPE_UCHAR:
|
case BASE_TYPE_UCHAR:
|
||||||
return "\"type\" : \"integer\", \"minimum\" : 0, \"maximum\" :" +
|
return "\"type\" : \"integer\", \"minimum\" : 0, \"maximum\" :" +
|
||||||
NumToString(std::numeric_limits<uint8_t>::max()) + "\"";
|
NumToString(std::numeric_limits<uint8_t>::max());
|
||||||
case BASE_TYPE_SHORT:
|
case BASE_TYPE_SHORT:
|
||||||
return "\"type\" : \"integer\", \"minimum\" : " +
|
return "\"type\" : \"integer\", \"minimum\" : " +
|
||||||
NumToString(std::numeric_limits<int16_t>::min()) +
|
NumToString(std::numeric_limits<int16_t>::min()) +
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"maxItems": 15
|
"maxItems": 15
|
||||||
},
|
},
|
||||||
"c" : {
|
"c" : {
|
||||||
"type" : "integer", "minimum" : -128, "maximum" : 127"
|
"type" : "integer", "minimum" : -128, "maximum" : 127
|
||||||
},
|
},
|
||||||
"d" : {
|
"d" : {
|
||||||
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_NestedStruct"},
|
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_NestedStruct"},
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
"type" : "integer", "minimum" : -32768, "maximum" : 32767
|
"type" : "integer", "minimum" : -32768, "maximum" : 32767
|
||||||
},
|
},
|
||||||
"b" : {
|
"b" : {
|
||||||
"type" : "integer", "minimum" : -128, "maximum" : 127"
|
"type" : "integer", "minimum" : -128, "maximum" : 127
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties" : false
|
"additionalProperties" : false
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
"deprecated" : true,
|
"deprecated" : true,
|
||||||
},
|
},
|
||||||
"inventory" : {
|
"inventory" : {
|
||||||
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255"}
|
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255}
|
||||||
},
|
},
|
||||||
"color" : {
|
"color" : {
|
||||||
"$ref" : "#/definitions/MyGame_Example_Color"
|
"$ref" : "#/definitions/MyGame_Example_Color"
|
||||||
@@ -190,7 +190,7 @@
|
|||||||
"$ref" : "#/definitions/MyGame_Example_Monster"
|
"$ref" : "#/definitions/MyGame_Example_Monster"
|
||||||
},
|
},
|
||||||
"testnestedflatbuffer" : {
|
"testnestedflatbuffer" : {
|
||||||
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255"}
|
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255}
|
||||||
},
|
},
|
||||||
"testempty" : {
|
"testempty" : {
|
||||||
"$ref" : "#/definitions/MyGame_Example_Stat"
|
"$ref" : "#/definitions/MyGame_Example_Stat"
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Ability"}
|
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Ability"}
|
||||||
},
|
},
|
||||||
"flex" : {
|
"flex" : {
|
||||||
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255"}
|
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255}
|
||||||
},
|
},
|
||||||
"test5" : {
|
"test5" : {
|
||||||
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Test"}
|
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Test"}
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
"$ref" : "#/definitions/MyGame_Example_Race"
|
"$ref" : "#/definitions/MyGame_Example_Race"
|
||||||
},
|
},
|
||||||
"testrequirednestedflatbuffer" : {
|
"testrequirednestedflatbuffer" : {
|
||||||
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255"}
|
"type" : "array", "items" : {"type" : "integer", "minimum" : 0, "maximum" :255}
|
||||||
},
|
},
|
||||||
"scalar_key_sorted_tables" : {
|
"scalar_key_sorted_tables" : {
|
||||||
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Stat"}
|
"type" : "array", "items" : {"$ref" : "#/definitions/MyGame_Example_Stat"}
|
||||||
@@ -311,10 +311,10 @@
|
|||||||
"type" : "object",
|
"type" : "object",
|
||||||
"properties" : {
|
"properties" : {
|
||||||
"i8" : {
|
"i8" : {
|
||||||
"type" : "integer", "minimum" : -128, "maximum" : 127"
|
"type" : "integer", "minimum" : -128, "maximum" : 127
|
||||||
},
|
},
|
||||||
"u8" : {
|
"u8" : {
|
||||||
"type" : "integer", "minimum" : 0, "maximum" :255"
|
"type" : "integer", "minimum" : 0, "maximum" :255
|
||||||
},
|
},
|
||||||
"i16" : {
|
"i16" : {
|
||||||
"type" : "integer", "minimum" : -32768, "maximum" : 32767
|
"type" : "integer", "minimum" : -32768, "maximum" : 32767
|
||||||
@@ -341,7 +341,7 @@
|
|||||||
"type" : "number"
|
"type" : "number"
|
||||||
},
|
},
|
||||||
"v8" : {
|
"v8" : {
|
||||||
"type" : "array", "items" : {"type" : "integer", "minimum" : -128, "maximum" : 127"}
|
"type" : "array", "items" : {"type" : "integer", "minimum" : -128, "maximum" : 127}
|
||||||
},
|
},
|
||||||
"vf64" : {
|
"vf64" : {
|
||||||
"type" : "array", "items" : {"type" : "number"}
|
"type" : "array", "items" : {"type" : "number"}
|
||||||
|
|||||||
Reference in New Issue
Block a user