add check for root_type specified for json schema generation (#5622)

This commit is contained in:
Dmitry 2019-11-11 22:33:27 +03:00 committed by Wouter van Oortmerssen
parent 405c64e07d
commit cbbd6aca04
1 changed files with 1 additions and 0 deletions

View File

@ -122,6 +122,7 @@ class JsonSchemaGenerator : public BaseGenerator {
: BaseGenerator(base_generator) {}
bool generate() {
if (parser_.root_struct_def_ == nullptr) { return false; }
code_.Clear();
code_ += "{";
code_ += " \"$schema\": \"http://json-schema.org/draft-04/schema#\",";