Skip to content

Feature/schema endpoint #21836

New issue

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

Open
wants to merge 33 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
529e205
feature(api): Added an endpoint _api/schema/<collection-name>
knakatasf Jun 17, 2025
34c78d6
feature(api): Added an endpoint /_api/schema/<collection-name>
knakatasf Jun 17, 2025
2fdf54e
debug(api): Corrected aql and parameter input validation logic
knakatasf Jun 17, 2025
413607e
feature(api): Added /_api/schema endpoint
knakatasf Jun 19, 2025
6a09ec8
feature(api): Added graph insights to /_api/schema endpoint
knakatasf Jun 20, 2025
fb776d9
chore(test): Added a testing function RestSchemaHandlerTest
knakatasf Jun 21, 2025
20f902c
chore(RestSchemaHanlderTest): Added a setup and testing fucntion
knakatasf Jun 22, 2025
b9fe0f3
chore(test): Added tests/js/client/shell/api/rest-schema-handler.js
knakatasf Jun 23, 2025
1baaa6f
feature(api): Refactored schema endpoint
knakatasf Jun 24, 2025
c66f6c4
chore(debug): Corrected the logic of schema endpoint and added testin…
knakatasf Jun 25, 2025
c749d2b
feature(api): Added schema/graph endpoint and error handlings
knakatasf Jun 26, 2025
84f9458
chore(test): Added schema/graph endpoint tests
knakatasf Jun 26, 2025
2c2df29
feature(api): Added /_api/view/<view-name> endpoint
knakatasf Jun 30, 2025
63b607c
feature(api): Added views attribute to schema endpoint
knakatasf Jul 1, 2025
f3e5ab2
feature(api): Refactored RestSchemaHandler's helper functions' return…
knakatasf Jul 1, 2025
7a2644c
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sch…
knakatasf Jul 2, 2025
f1a2e87
chore(test): Added test for rest-schema-handler
knakatasf Jul 2, 2025
be86a67
chore(lint): Sanitized the indentations and format of the code
knakatasf Jul 3, 2025
d1a8b1e
chore(docs): Updated CHANGELOG
knakatasf Jul 4, 2025
388d7d8
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sch…
knakatasf Jul 4, 2025
b87ce3a
chore: sync and merged devel change (README)
knakatasf Jul 4, 2025
d4ecba7
chore: Refactor RestSchemaHandler helper method return types, add use…
knakatasf Jul 4, 2025
b790727
chore(bug): Changed RestSchemaHandler so that it will work in a cluster
knakatasf Jul 5, 2025
e35bc95
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sch…
knakatasf Jul 8, 2025
96db1b7
feature(api): Refactored RestSchemaHandler for better efficiency and …
knakatasf Jul 8, 2025
5bb7742
chore(test): Edited rest-schema-handler.js
knakatasf Jul 9, 2025
277704a
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sch…
knakatasf Jul 9, 2025
2415163
chore(api): Refactored RestSchemaHandler (graphs, orphans) and change…
knakatasf Jul 10, 2025
e05be98
chore(test): Refined and added some tests
knakatasf Jul 10, 2025
9db5379
chore: Refactored RestSchemaHandler
knakatasf Jul 13, 2025
bb31366
Merge branch 'devel' of github.com:arangodb/arangodb into feature/sch…
knakatasf Jul 14, 2025
df1a4d1
chore: Refactored RestSchemaHander so it inherits from RestVocbaseBas…
knakatasf Jul 14, 2025
0e90e5f
chore: Organized GeneralServerFeature.cpp
knakatasf Jul 15, 2025
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
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
devel
-----
* Add new API GET /_api/schema to show the sampled schemas of graphs, views, collections along with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Add new API GET /_api/schema to show graphs, views, collections along with
* Add new API GET /_api/schema to show the sampled schema of graphs, views, collections along with

/_api/schema/graph/<graph-name>: Provides the sampled schemas of graph and connected collections
/_api/schema/view/<view-name>: Displays the sample schemas of view and linked collections
/_api/schema/collection/<collection-name>: Gives the sampled schemas of collection and schemas.

* Move crash handling to a separate thread, this is cleaner and does not
violate rules for signal and termination handlers.
Expand Down
13 changes: 6 additions & 7 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ flexible, extensible, and easily imported from your existing document database.
**ArangoSearch** - Natively integrated cross-platform indexing, text-search and
ranking engine for information retrieval, optimized for speed and memory.

ArangoDB is available in a free and open-source **Community Edition**, as well
as a commercial **Enterprise Edition** with additional features.
ArangoDB is available in a free and fully featured **Community Edition** as well
as an **Enterprise Edition** for commercial use and without a dataset size limit.

### Community Edition features
### Core Features

- **Horizontal scalability**: Seamlessly shard your data across multiple machines.
- **High availability** and **resilience**: Replicate data to multiple cluster
Expand All @@ -71,12 +71,11 @@ as a commercial **Enterprise Edition** with additional features.
- Easy to use **web interface** and **command-line tools** for interaction
with the server.

### Enterprise Edition features
### Scalability Features

Focus on solving enterprise-scale problems for mission critical workloads using
secure graph data. The Enterprise Edition has all the features of the
Community Edition and offers additional features for performance, compliance,
and security, as well as further query capabilities.
secure graph data. ArangoDB offers special features for performance, compliance,
and security, as well as advanced query capabilities.

- Smartly shard and replicate graphs and datasets with features like
**EnterpriseGraphs**, **SmartGraphs**, and **SmartJoins** for lightning fast
Expand Down
4 changes: 4 additions & 0 deletions arangod/GeneralServer/GeneralServerFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
#include "RestHandler/RestQueryCacheHandler.h"
#include "RestHandler/RestQueryPlanCacheHandler.h"
#include "RestHandler/RestQueryHandler.h"
#include "RestHandler/RestSchemaHandler.h"
#include "RestHandler/RestShutdownHandler.h"
#include "RestHandler/RestSimpleHandler.h"
#include "RestHandler/RestSimpleQueryHandler.h"
Expand Down Expand Up @@ -713,6 +714,9 @@ void GeneralServerFeature::defineRemainingHandlers(
f.addPrefixHandler(RestVocbaseBaseHandler::VIEW_PATH,
RestHandlerCreator<RestViewHandler>::createNoData);

f.addPrefixHandler(RestVocbaseBaseHandler::SCHEMA_PATH,
RestHandlerCreator<RestSchemaHandler>::createNoData);

if (::arangodb::replication2::EnableReplication2 && cluster.isEnabled()) {
f.addPrefixHandler(std::string{StaticStrings::ApiLogExternal},
RestHandlerCreator<RestLogHandler>::createNoData);
Expand Down
33 changes: 33 additions & 0 deletions arangod/Graph/GraphManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,39 @@ ResultT<std::unique_ptr<Graph>> GraphManager::lookupGraphByName(
return {Graph::fromPersistence(_vocbase, result.slice())};
}

ResultT<std::vector<std::unique_ptr<Graph>>> GraphManager::lookupAllGraphs()
const {
VPackBuilder graphsBuilder;
Result res = readGraphs(graphsBuilder);
if (res.fail()) {
std::stringstream ss;
ss << "while looking up all graphs: " << res.errorMessage();
res.reset(res.errorNumber(), ss.str());
return {res};
}

VPackSlice graphs = graphsBuilder.slice();
if (!graphs.isObject() || !graphs.hasKey("graphs") ||
!graphs.get("graphs").isArray()) {
TRI_ASSERT(graphs.isObject() && graphs.hasKey("graphs") && graphs.get("graphs").isArray());
return Result{TRI_ERROR_GRAPH_INTERNAL_DATA_CORRUPT,
"readGraphs() returned malformed data"};
}

std::vector<std::unique_ptr<Graph>> out;
out.reserve(graphs.get("graphs").length());
for (auto g : VPackArrayIterator(graphs.get("graphs"))) {
auto gPtr = Graph::fromPersistence(_vocbase, g);
if (!gPtr) {
TRI_ASSERT(gPtr);
return Result{TRI_ERROR_INTERNAL,
"Graph::fromPersistence failed for one of the graphs"};
}
out.emplace_back(std::move(gPtr));
}
return out;
}

OperationResult GraphManager::createGraph(VPackSlice document,
bool waitForSync) const {
OperationOptions options(ExecContext::current());
Expand Down
5 changes: 5 additions & 0 deletions arangod/Graph/GraphManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ class GraphManager {
ResultT<std::unique_ptr<Graph>> lookupGraphByName(
std::string const& name) const;

////////////////////////////////////////////////////////////////////////////////
/// @brief lookup all graphs
////////////////////////////////////////////////////////////////////////////////
ResultT<std::vector<std::unique_ptr<Graph>>> lookupAllGraphs() const;

////////////////////////////////////////////////////////////////////////////////
/// @brief create a graph
////////////////////////////////////////////////////////////////////////////////
Expand Down
Loading