Class JsonSchemaBeforeWriteChecker
java.lang.Object
org.restheart.mongodb.interceptors.JsonSchemaBeforeWriteChecker
- All Implemented Interfaces:
ConfigurablePlugin,ExchangeTypeResolver<MongoRequest,,MongoResponse> Interceptor<MongoRequest,,MongoResponse> MongoInterceptor,Plugin
- Direct Known Subclasses:
JsonSchemaAfterWriteChecker
Checks documents according to the specified JSON schema
This intercetor is able to check PUT and POST requests that don't use update
operators. PATCH requests are checked by jsonSchemaAfterWrite
Note that checking bulk PATCH, i.e. PATCH /coll/*, is not supported. In this case the optional metadata property 'skipNotSuppored' controls the behaviour: if true, the request is not checked and executed, if false the request fails. It checks the request content against the JSON schema specified by the 'jsonSchema' collection metadata:
{ "jsonSchema": { "schemaId": <schemaId> "schemaStoreDb": <schemaStoreDb>, "skipNotSupported": <boolean> } }
schemaStoreDb is optional, default value is same db, skipNotSuppored is optional, defaul value is false
Note that checking bulk PATCH, i.e. PATCH /coll/*, is not supported. In this case the optional metadata property 'skipNotSuppored' controls the behaviour: if true, the request is not checked and executed, if false the request fails. It checks the request content against the JSON schema specified by the 'jsonSchema' collection metadata:
{ "jsonSchema": { "schemaId": <schemaId> "schemaStoreDb": <schemaStoreDb>, "skipNotSupported": <boolean> } }
schemaStoreDb is optional, default value is same db, skipNotSuppored is optional, defaul value is false
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandle(MongoRequest request, MongoResponse response) booleanresolve(MongoRequest request, MongoResponse response) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.restheart.plugins.ConfigurablePlugin
arg, argOrDefaultMethods inherited from interface org.restheart.plugins.ExchangeTypeResolver
requestType, responseType
-
Field Details
-
SCHEMA_STORE_DB_PROPERTY
- See Also:
-
SCHEMA_ID_PROPERTY
- See Also:
-
SKIP_NOT_SUPPORTED_PROPERTY
- See Also:
-
-
Constructor Details
-
JsonSchemaBeforeWriteChecker
public JsonSchemaBeforeWriteChecker()
-
-
Method Details
-
handle
- Specified by:
handlein interfaceInterceptor<MongoRequest,MongoResponse> - Throws:
Exception
-
resolve
- Specified by:
resolvein interfaceInterceptor<MongoRequest,MongoResponse>
-