diff --git a/include/rapidjson/error/en.h b/include/rapidjson/error/en.h index cd4a99a..f27d62a 100644 --- a/include/rapidjson/error/en.h +++ b/include/rapidjson/error/en.h @@ -125,9 +125,6 @@ inline const RAPIDJSON_ERROR_CHARTYPE* GetValidateError_En(ValidateErrorCode val switch (schemaErrorCode) { case kSchemaErrorNone: return RAPIDJSON_ERROR_STRING("No error."); - case kSchemaErrorSpecUnknown: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not recognized."); - case kSchemaErrorSpecUnsupported: return RAPIDJSON_ERROR_STRING("JSON schema draft or OpenAPI version is not supported."); - case kSchemaErrorSpecIllegal: return RAPIDJSON_ERROR_STRING("Both JSON schema draft and OpenAPI version found in document."); case kSchemaErrorStartUnknown: return RAPIDJSON_ERROR_STRING("Pointer '%value' to start of schema does not resolve to a location in the document."); case kSchemaErrorRefPlainName: return RAPIDJSON_ERROR_STRING("$ref fragment '%value' must be a JSON pointer."); case kSchemaErrorRefInvalid: return RAPIDJSON_ERROR_STRING("$ref must not be an empty string."); @@ -136,7 +133,6 @@ inline const RAPIDJSON_ERROR_CHARTYPE* GetValidateError_En(ValidateErrorCode val case kSchemaErrorRefCyclical: return RAPIDJSON_ERROR_STRING("$ref '%value' is cyclical."); case kSchemaErrorRefNoRemoteProvider: return RAPIDJSON_ERROR_STRING("$ref is remote but there is no remote provider."); case kSchemaErrorRefNoRemoteSchema: return RAPIDJSON_ERROR_STRING("$ref '%value' is remote but the remote provider did not return a schema."); - case kSchemaErrorReadOnlyAndWriteOnly: return RAPIDJSON_ERROR_STRING("Property must not be both 'readOnly' and 'writeOnly'."); case kSchemaErrorRegexInvalid: return RAPIDJSON_ERROR_STRING("Invalid regular expression '%value' in 'pattern' or 'patternProperties'."); default: return RAPIDJSON_ERROR_STRING("Unknown error."); diff --git a/include/rapidjson/error/error.h b/include/rapidjson/error/error.h index 64613be..d2a2fc4 100644 --- a/include/rapidjson/error/error.h +++ b/include/rapidjson/error/error.h @@ -217,9 +217,6 @@ typedef const RAPIDJSON_ERROR_CHARTYPE* (*GetValidateErrorFunc)(ValidateErrorCod enum SchemaErrorCode { kSchemaErrorNone = 0, //!< No error. - kSchemaErrorSpecUnknown, //!< JSON schema draft or OpenAPI version is not recognized - kSchemaErrorSpecUnsupported, //!< JSON schema draft or OpenAPI version is not supported - kSchemaErrorSpecIllegal, //!< Both JSON schema draft and OpenAPI version found in document kSchemaErrorStartUnknown, //!< Pointer to start of schema does not resolve to a location in the document kSchemaErrorRefPlainName, //!< $ref fragment must be a JSON pointer kSchemaErrorRefInvalid, //!< $ref must not be an empty string @@ -228,7 +225,6 @@ enum SchemaErrorCode { kSchemaErrorRefCyclical, //!< $ref is cyclical kSchemaErrorRefNoRemoteProvider, //!< $ref is remote but there is no remote provider kSchemaErrorRefNoRemoteSchema, //!< $ref is remote but the remote provider did not return a schema - kSchemaErrorReadOnlyAndWriteOnly, //!< Property must not be both 'readOnly' and 'writeOnly' kSchemaErrorRegexInvalid //!< Invalid regular expression in 'pattern' or 'patternProperties' }; diff --git a/test/unittest/schematest.cpp b/test/unittest/schematest.cpp index f180f3b..3d12398 100644 --- a/test/unittest/schematest.cpp +++ b/test/unittest/schematest.cpp @@ -2152,7 +2152,7 @@ public: virtual const SchemaDocumentType* GetRemoteDocument(const char* uri, SizeType length) { for (size_t i = 0; i < kCount; i++) - if (typename SchemaDocumentType::SValue(uri, length) == sd_[i]->GetURI()) + if (typename SchemaDocumentType::GValue(uri, length) == sd_[i]->GetURI()) return sd_[i]; return 0; } @@ -2995,15 +2995,6 @@ TEST(SchemaValidator, Schema_StartUnknown) { SCHEMAERROR(s, "{\"StartUnknown\":{\"errorCode\":1,\"instanceRef\":\"#\", \"value\":\"#/nowhere\"}}"); } -// $ref is a non-JSON pointer fragment - not allowed when OpenAPI -TEST(SchemaValidator, Schema_RefPlainNameOpenApi) { - typedef GenericSchemaDocument > SchemaDocumentType; - Document sd; - sd.Parse("{\"swagger\": \"2.0\", \"type\": \"object\", \"properties\": {\"myInt1\": {\"$ref\": \"#myId\"}, \"myStr\": {\"type\": \"string\", \"id\": \"#myStrId\"}, \"myInt2\": {\"type\": \"integer\", \"id\": \"#myId\"}}}"); - SchemaDocumentType s(sd); - SCHEMAERROR(s, "{\"RefPlainName\":{\"errorCode\":2,\"instanceRef\":\"#/properties/myInt1\",\"value\":\"#myId\"}}"); -} - // $ref is a non-JSON pointer fragment - not allowed when remote document TEST(SchemaValidator, Schema_RefPlainNameRemote) { typedef GenericSchemaDocument > SchemaDocumentType;