1
0
Fork 0

changed default for keepNull of modifyVertex/modifyEdge to true in Gharial

This commit is contained in:
Mark 2016-09-07 10:31:35 +02:00
parent 55777598e8
commit f0c0359e47
5 changed files with 93 additions and 4 deletions

View File

@ -1,5 +1,6 @@
devel
-----
* changed default for keepNull of modifyVertex/modifyEdge to true in Gharial
* renamed `maximalSize` attribute in parameter.json files to `journalSize`

View File

@ -24,7 +24,7 @@ The *_key* attribute of the vertex.
Define if the request should wait until synced to disk.
@RESTPARAM{keepNull, boolean, optional}
Define if values set to null should be stored. By default the key is removed from the document.
Define if values set to null should be stored. By default the key is not removed from the document.
@RESTALLBODYPARAM{updateAttributes,object,required}
The body has to be a JSON object containing the attributes to be updated.

View File

@ -24,7 +24,7 @@ The *_key* attribute of the vertex.
Define if the request should wait until synced to disk.
@RESTPARAM{keepNull, boolean, optional}
Define if values set to null should be stored. By default the key is removed from the document.
Define if values set to null should be stored. By default the key is not removed from the document.
@RESTHEADERPARAMETERS

View File

@ -167,7 +167,7 @@ describe ArangoDB do
cmd = edge_endpoint(graph_name, collection, key)
cmd = cmd + "?waitForSync=#{waitForSync}"
if keepNull != '' then
cmd = cmd + "&keepNull=" + keepNull
cmd = cmd + "&keepNull=#{keepNull}"
end
doc = ArangoDB.patch(cmd, :body => JSON.dump(body))
return doc
@ -489,6 +489,35 @@ describe ArangoDB do
doc.parsed_response['vertex']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['vertex']['_key'].should eq(key)
end
it "can update a vertex keepNull default(true)" do
doc = create_vertex( sync, graph_name, user_collection, {"name" => "Alice"})
key = doc.parsed_response['vertex']['_key']
doc = update_vertex( sync, graph_name, user_collection, key, {"name" => nil}, "")
doc.code.should eq(sync ? 200 : 202)
doc = get_vertex(graph_name, user_collection, key)
doc.parsed_response['vertex'].key?('name').should eq(true)
doc.parsed_response['vertex']['name'].should eq(nil)
end
it "can update a vertex keepNull false" do
doc = create_vertex( sync, graph_name, user_collection, {"name" => "Alice"})
key = doc.parsed_response['vertex']['_key']
doc = update_vertex( sync, graph_name, user_collection, key, {"name" => nil}, false)
doc.code.should eq(sync ? 200 : 202)
doc = get_vertex(graph_name, user_collection, key)
doc.parsed_response['vertex'].key?('name').should eq(false)
end
it "can update a vertex keepNull true" do
doc = create_vertex( sync, graph_name, user_collection, {"name" => "Alice"})
key = doc.parsed_response['vertex']['_key']
doc = update_vertex( sync, graph_name, user_collection, key, {"name" => nil}, true)
doc.code.should eq(sync ? 200 : 202)
doc = get_vertex(graph_name, user_collection, key)
doc.parsed_response['vertex'].key?('name').should eq(true)
doc.parsed_response['vertex']['name'].should eq(nil)
end
it "can not update a non existing vertex" do
key = "unknownKey"
@ -653,6 +682,65 @@ describe ArangoDB do
doc.parsed_response['edge']['_rev'].should eq(doc.headers['etag'])
doc.parsed_response['edge']['_key'].should eq(key)
end
it "can update an edge keepNull default(true)" do
v1 = create_vertex( sync, graph_name, user_collection, {})
v1.code.should eq(sync ? 201 : 202)
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex( sync, graph_name, user_collection, {})
v2.code.should eq(sync ? 201 : 202)
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge( sync, graph_name, friend_collection, v1, v2, {"type" => type})
doc.code.should eq(202)
key = doc.parsed_response['edge']['_key']
doc = update_edge( sync, graph_name, friend_collection, key, {"type" => nil}, "")
doc.code.should eq(sync ? 200 : 202)
doc = get_edge(graph_name, friend_collection, key)
doc.parsed_response['edge'].key?('type').should eq(true)
doc.parsed_response['edge']['type'].should eq(nil)
end
it "can update an edge keepNull true" do
v1 = create_vertex( sync, graph_name, user_collection, {})
v1.code.should eq(sync ? 201 : 202)
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex( sync, graph_name, user_collection, {})
v2.code.should eq(sync ? 201 : 202)
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge( sync, graph_name, friend_collection, v1, v2, {"type" => type})
doc.code.should eq(202)
key = doc.parsed_response['edge']['_key']
doc = update_edge( sync, graph_name, friend_collection, key, {"type" => nil}, true)
doc.code.should eq(sync ? 200 : 202)
doc = get_edge(graph_name, friend_collection, key)
doc.parsed_response['edge'].key?('type').should eq(true)
doc.parsed_response['edge']['type'].should eq(nil)
end
it "can update an edge keepNull false" do
v1 = create_vertex( sync, graph_name, user_collection, {})
v1.code.should eq(sync ? 201 : 202)
v1 = v1.parsed_response['vertex']['_id']
v2 = create_vertex( sync, graph_name, user_collection, {})
v2.code.should eq(sync ? 201 : 202)
v2 = v2.parsed_response['vertex']['_id']
type = "married"
doc = create_edge( sync, graph_name, friend_collection, v1, v2, {"type" => type})
doc.code.should eq(202)
key = doc.parsed_response['edge']['_key']
doc = update_edge( sync, graph_name, friend_collection, key, {"type" => nil}, false)
doc.code.should eq(sync ? 200 : 202)
doc = get_edge(graph_name, friend_collection, key)
doc.parsed_response['edge'].key?('type').should eq(false)
end
it "can not update a non existing edge" do
key = "unknownKey"

View File

@ -183,7 +183,7 @@ const edgeKey = joi.string()
.description('_key attribute of one specific edge.');
const keepNullFlag = phpCompatFlag
.description('define if null values should not be deleted.');
.description('define if null values should not be deleted.').default(true);
// Graph Creation