review comment updates

This commit is contained in:
Steve Hanson 2022-12-16 10:06:12 +00:00 committed by Milo Yip
parent 55eca66f39
commit b08672d469
3 changed files with 16 additions and 5 deletions

View File

@ -22,13 +22,15 @@
* RapidJSON should be fully RFC4627/ECMA-404 compliance.
* Support JSON Pointer (RFC6901).
* Support JSON Schema Draft v4.
* Support Swagger v2 schema.
* Support OpenAPI v3.0.x schema.
* Support Unicode surrogate.
* Support null character (`"\u0000"`)
* For example, `["Hello\u0000World"]` can be parsed and handled gracefully. There is API for getting/setting lengths of string.
* For example, `["Hello\u0000World"]` can be parsed and handled gracefully. There is API for getting/setting lengths of string.
* Support optional relaxed syntax.
* Single line (`// ...`) and multiple line (`/* ... */`) comments (`kParseCommentsFlag`).
* Trailing commas at the end of objects and arrays (`kParseTrailingCommasFlag`).
* `NaN`, `Inf`, `Infinity`, `-Inf` and `-Infinity` as `double` values (`kParseNanAndInfFlag`)
* Single line (`// ...`) and multiple line (`/* ... */`) comments (`kParseCommentsFlag`).
* Trailing commas at the end of objects and arrays (`kParseTrailingCommasFlag`).
* `NaN`, `Inf`, `Infinity`, `-Inf` and `-Infinity` as `double` values (`kParseNanAndInfFlag`)
* [NPM compliant](http://github.com/Tencent/rapidjson/blob/master/doc/npm.md).
## Unicode

View File

@ -24,7 +24,15 @@ if (sd.Parse(schemaJson).HasParseError()) {
// the schema is not a valid JSON.
// ...
}
SchemaDocument schema(sd); // Compile a Document to SchemaDocument
if (!schema.GetError().ObjectEmpty()) {
// there was a problem compiling the schema
StringBuffer sb;
Writer<StringBuffer> w(sb);
schema.GetError().Accept(w);
printf("Invalid schema: %s\n", sb.GetString());
}
// sd is no longer needed here.
Document d;

View File

@ -1794,7 +1794,8 @@ public:
virtual const SchemaDocumentType* GetRemoteDocument(const GenericUri<ValueType, AllocatorType> uri, Specification& spec) {
// Default implementation just calls through for compatibility
// Following line suppresses unused parameter warning
if (false) printf("GetRemoteDocument: %d %d\n", spec.draft, spec.oapi);
(void)spec;
// printf("GetRemoteDocument: %d %d\n", spec.draft, spec.oapi);
return GetRemoteDocument(uri.GetBaseString(), uri.GetBaseStringLength());
}
};