mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-07 13:53:38 +00:00
Escape characters in jsonschema descriptions (#5644)
* Escape JSON Schema comments * Add quotes to monster comment Thus exercising the JSON Schema comment escape support.
This commit is contained in:
@@ -155,7 +155,12 @@ class JsonSchemaGenerator : public BaseGenerator {
|
||||
comment.append(*comment_line);
|
||||
}
|
||||
if (comment.size() > 0) {
|
||||
code_ += " \"description\" : \"" + comment + "\",";
|
||||
std::string description;
|
||||
if (!EscapeString(comment.c_str(), comment.length(), &description, true,
|
||||
true)) {
|
||||
return false;
|
||||
}
|
||||
code_ += " \"description\" : " + description + ",";
|
||||
}
|
||||
code_ += " \"properties\" : {";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user