Issue error if jsonschema has no root type defined #6821 (#6831)

This commit is contained in:
schoetbi
2021-09-02 23:24:47 +02:00
committed by GitHub
parent c3a38242e6
commit 550d2f9048

View File

@@ -198,7 +198,10 @@ class JsonSchemaGenerator : public BaseGenerator {
bool generate() {
code_ = "";
if (parser_.root_struct_def_ == nullptr) { return false; }
if (parser_.root_struct_def_ == nullptr) {
std::cerr << "Error: Binary schema not generated, no root struct found\n";
return false;
}
code_ += "{" + NewLine();
code_ += Indent(1) +
"\"$schema\": \"https://json-schema.org/draft/2019-09/schema\"," +