diff --git a/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs b/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs index edb66d3e..98f096e5 100644 --- a/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs +++ b/arangodb-net-standard.Test/GraphApi/GraphApiClientTest.cs @@ -36,12 +36,14 @@ public async Task GetGraphsAsync_ShouldSucceed() var graph = graphsResult.Graphs.First(x => x._key == _fixture.TestGraph); Assert.NotEmpty(graph.EdgeDefinitions); Assert.Empty(graph.OrphanCollections); - Assert.Equal(1, graph.NumberOfShards); - Assert.Equal(1, graph.ReplicationFactor); - Assert.False(graph.IsSmart); Assert.Equal(_fixture.TestGraph, graph._key); Assert.Equal("_graphs/" + _fixture.TestGraph, graph._id); Assert.NotNull(graph._rev); + + // cluster-only values, not returned for a single server since 3.7 + Assert.False(graph.NumberOfShards.HasValue); + Assert.False(graph.ReplicationFactor.HasValue); + Assert.False(graph.IsSmart.HasValue); } [Fact] @@ -93,12 +95,14 @@ public async Task GetGraphAsync_ShouldSucceed() Assert.Equal("_graphs/" + _fixture.TestGraph, response.Graph._id); Assert.NotEmpty(response.Graph.EdgeDefinitions); Assert.Empty(response.Graph.OrphanCollections); - Assert.Equal(1, response.Graph.NumberOfShards); - Assert.Equal(1, response.Graph.ReplicationFactor); - Assert.False(response.Graph.IsSmart); Assert.Equal(_fixture.TestGraph, response.Graph._key); Assert.Equal("_graphs/" + _fixture.TestGraph, response.Graph._id); Assert.NotNull(response.Graph._rev); + + // cluster-only values, not returned for a single server since 3.7 + Assert.False(response.Graph.NumberOfShards.HasValue); + Assert.False(response.Graph.ReplicationFactor.HasValue); + Assert.False(response.Graph.IsSmart.HasValue); } [Fact] @@ -294,6 +298,11 @@ public async Task PostEdgeDefinitionAsync_ShouldSucceed() Assert.NotNull(response.Graph._rev); Assert.False(response.Graph.IsSmart); Assert.Empty(response.Graph.OrphanCollections); + + // cluster-only values, not returned for a single server since 3.7 + Assert.False(response.Graph.NumberOfShards.HasValue); + Assert.False(response.Graph.ReplicationFactor.HasValue); + Assert.False(response.Graph.IsSmart.HasValue); } [Fact] diff --git a/arangodb-net-standard/GraphApi/GraphApiClient.cs b/arangodb-net-standard/GraphApi/GraphApiClient.cs index a4779228..14756318 100644 --- a/arangodb-net-standard/GraphApi/GraphApiClient.cs +++ b/arangodb-net-standard/GraphApi/GraphApiClient.cs @@ -51,6 +51,9 @@ public GraphApiClient(IApiClientTransport transport, IApiClientSerialization ser /// Creates a new graph in the graph module. /// POST /_api/gharial /// + /// + /// The creation of a graph requires the name of the graph and a definition of its edges. + /// /// The information of the graph to create. /// Optional query parameters of the request. /// @@ -370,7 +373,7 @@ public virtual async Task> PostEdgeAsync( string collectionName, T edge, PostEdgeQuery query = null, - ApiClientSerializationOptions serializationOptions = null) + ApiClientSerializationOptions serializationOptions = null) { var content = GetContent(edge, serializationOptions); @@ -735,7 +738,7 @@ public virtual async Task> PutEdgeAsync( uri += "?" + query.ToQueryString(); } - var content = GetContent(edge, new ApiClientSerializationOptions(false,false)); + var content = GetContent(edge, new ApiClientSerializationOptions(false, false)); using (var response = await _transport.PutAsync(uri, content)) { if (response.IsSuccessStatusCode) diff --git a/arangodb-net-standard/GraphApi/Models/GraphResult.cs b/arangodb-net-standard/GraphApi/Models/GraphResult.cs index c0118e4e..eb9ba546 100644 --- a/arangodb-net-standard/GraphApi/Models/GraphResult.cs +++ b/arangodb-net-standard/GraphApi/Models/GraphResult.cs @@ -37,9 +37,13 @@ public class GraphResult public string SmartGraphAttribute { get; set; } /// - /// The replication factor used for every new collection in the graph. + /// The replication factor used for every new collection in the graph (Enterprise Edition only). /// - public int ReplicationFactor { get; set; } + /// + /// Returned only in a cluster setup since ArangoDB 3.7, + /// as this property is not meaningful in a single server. + /// + public int? ReplicationFactor { get; set; } /// /// A list of additional vertex collections. @@ -50,12 +54,20 @@ public class GraphResult /// /// Number of shards created for every new collection in the graph. /// - public int NumberOfShards { get; set; } + /// + /// Returned only in a cluster setup since ArangoDB 3.7, + /// as this property is not meaningful in a single server. + /// + public int? NumberOfShards { get; set; } /// /// Indicates whether the graph is a SmartGraph (Enterprise Edition only). /// - public bool IsSmart { get; set; } + /// + /// Returned only in a cluster setup since ArangoDB 3.7, + /// as this property is not meaningful in a single server. + /// + public bool? IsSmart { get; set; } /// /// A list of definitions for the relations of the graph. diff --git a/arangodb-net-standard/GraphApi/Models/PostGraphBody.cs b/arangodb-net-standard/GraphApi/Models/PostGraphBody.cs index 6a5f4457..b0095d88 100644 --- a/arangodb-net-standard/GraphApi/Models/PostGraphBody.cs +++ b/arangodb-net-standard/GraphApi/Models/PostGraphBody.cs @@ -2,16 +2,41 @@ namespace ArangoDBNetStandard.GraphApi.Models { + /// + /// Represents a request body to create a named graph. + /// + /// + /// The creation of a graph requires the name of the graph and a definition of its edges. + /// public class PostGraphBody { + /// + /// Name of the graph. + /// public string Name { get; set; } + /// + /// List of definitions for the relations of the graph. + /// public List EdgeDefinitions { get; set; } + /// + /// (Optional) List of additional vertex collections. + /// Documents within these collections do not have edges within this graph. + /// public List OrphanCollections { get; set; } + /// + /// (Optional) Defines if the created graph should be smart (Enterprise Edition only). + /// + /// + /// (cluster only) + /// public bool? IsSmart { get; set; } + /// + /// (Optional) Defines options for creating collections within this graph. + /// public PostGraphOptions Options { get; set; } } } diff --git a/arangodb-net-standard/GraphApi/Models/PostGraphOptions.cs b/arangodb-net-standard/GraphApi/Models/PostGraphOptions.cs index d18cda98..76a248af 100644 --- a/arangodb-net-standard/GraphApi/Models/PostGraphOptions.cs +++ b/arangodb-net-standard/GraphApi/Models/PostGraphOptions.cs @@ -10,9 +10,10 @@ public class PostGraphOptions /// It is required if creating a SmartGraph. /// Every vertex in this SmartGraph has to have this attribute. /// Cannot be modified later. + /// (Enterprise Edition only). /// /// - /// Only has effect in Enterprise Edition. + /// (cluster only) /// public string SmartGraphAttribute { get; set; } @@ -20,11 +21,18 @@ public class PostGraphOptions /// The number of shards that is used for every collection within this graph. /// Cannot be modified later. /// + /// + /// (cluster only) + /// public int NumberOfShards { get; set; } /// - /// The replication factor used when initially creating collections for this graph. + /// The replication factor used when initially creating collections for this graph + /// (Enterprise Edition only). /// + /// + /// (cluster only) + /// public int ReplicationFactor { get; set; } } }