10000 validation: AQL functions by ObiWahn · Pull Request #11327 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

validation: AQL functions #11327

New issue
8000

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rename Function to SCHEMA_GET
  • Loading branch information
ObiWahn committed Apr 1, 2020
commit 28c9f52c029d4483e5cb42a63e2984cec6eb9bc0
2 changes: 1 addition & 1 deletion arangod/Aql/AqlFunctionFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ void AqlFunctionFeature::addMiscFunctions() {
// C++ implementation
//
auto validationFlags = Function::makeFlags(FF::None);
add({"GET_SCHEMA", ".", validationFlags, &Functions::GetSchema});
add({"SCHEMA_GET", ".", validationFlags, &Functions::SchemaGet});
add({"SCHEMA_VALIDATE", ".,.", validationFlags, &Functions::SchemaValidate});

// special flags:
Expand Down
4 changes: 2 additions & 2 deletions arangod/Aql/Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7512,11 +7512,11 @@ AqlValue Functions::NotImplemented(ExpressionContext* expressionContext,
return AqlValue(AqlValueHintNull());
}

AqlValue Functions::GetSchema(ExpressionContext* expressionContext,
AqlValue Functions::SchemaGet(ExpressionContext* expressionContext,
transaction::Methods* trx,
VPackFunctionParameters const& parameters) {
// GET_VALIDATON(collectionName)
static char const* AFN = "GET_SCHEMA";
static char const* AFN = "SCHEMA_GET";

if (parameters.size() != 1) {
THROW_ARANGO_EXCEPTION_PARAMS(TRI_ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH, AFN);
Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ struct Functions {
static AqlValue CurrentUser(arangodb::aql::ExpressionContext*,
transaction::Methods*, VPackFunctionParameters const&);

static AqlValue GetSchema(arangodb::aql::ExpressionContext*,
static AqlValue SchemaGet(arangodb::aql::ExpressionContext*,
transaction::Methods*, VPackFunctionParameters const&);
static AqlValue SchemaValidate(arangodb::aql::ExpressionContext*,
transaction::Methods*, VPackFunctionParameters const&);
Expand Down
12 changes: 6 additions & 6 deletions tests/js/common/shell/shell-validation-rocksdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,30 +363,30 @@ function ValidationBasicsSuite () {

},
// AQL ////////////////////////////////////////////////////////////////////////////////////////////
test_GET_SCHEMA: () => {
test_SCHEMA_GET: () => {
validatorJson.level = "strict";
testCollection.properties({"validation" : validatorJson });
sleepInCluster();

// get regular schema
let res = db._query(`RETURN GET_SCHEMA("${testCollectionName}")`).toArray();
let res = db._query(`RETURN SCHEMA_GET("${testCollectionName}")`).toArray();
assertEqual(res[0], validatorJson.rule);
},

test_GET_SCHEMA_no_collection: () => {
test_SCHEMA_GET_no_collection: () => {
// schema on non existing collection
try {
db._query(`RETURN GET_SCHEMA("nonExistingTestCollection")`).toArray();
db._query(`RETURN SCHEMA_GET("nonExistingTestCollection")`).toArray();
fail();
} catch (err) {
assertEqual(ERRORS.ERROR_ARANGO_DATA_SOURCE_NOT_FOUND.code, err.errorNum);
}
},

test_GET_SCHEMA_null: () => {
test_SCHEMA_GET_null: () => {
// no validation available must return `null`
testCollection.properties({validation : {}});
let res = db._query(`RETURN GET_SCHEMA("${testCollectionName}")`).toArray();
let res = db._query(`RETURN SCHEMA_GET("${testCollectionName}")`).toArray();
assertEqual(res[0], null);
},

Expand Down
0