You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2022/06/03 13:57:32 UTC

[ignite-3] branch main updated: IGNITE-17072 Added docs for OpenAPI

This is an automated email from the ASF dual-hosted git repository.

agura pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f4a02c5a IGNITE-17072 Added docs for OpenAPI
3f4a02c5a is described below

commit 3f4a02c5a323c2062b58463494a89a5a5b0a6dd1
Author: IgGusev <de...@mail.ru>
AuthorDate: Fri Jun 3 16:49:39 2022 +0300

    IGNITE-17072 Added docs for OpenAPI
    
    Co-authored-by: Alexandr <Sa...@icloud.com>
    Signed-off-by: Andrey Gura <ag...@apache.org>
---
 docs/_data/toc.yaml           |  2 ++
 docs/_docs/rest/rest-api.adoc | 68 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/docs/_data/toc.yaml b/docs/_data/toc.yaml
index 89f12abbe..ef48673ed 100644
--- a/docs/_data/toc.yaml
+++ b/docs/_data/toc.yaml
@@ -32,6 +32,8 @@
       url: sql-reference/dml
     - title: Supported Operators and Functions
       url: sql-reference/operators-and-functions
+- title: REST API
+  url: rest/rest-api
 - title: Binary Client Protocol
   url: binary-protocol
 - title: Native Persistence
diff --git a/docs/_docs/rest/rest-api.adoc b/docs/_docs/rest/rest-api.adoc
new file mode 100644
index 000000000..6d0c61240
--- /dev/null
+++ b/docs/_docs/rest/rest-api.adoc
@@ -0,0 +1,68 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+= Ignite REST API
+
+Apache Ignite 3 clusters provide an link:https://www.openapis.org/[OpenAPI] specification that can be used to work with Ignite 3 by standard REST methods. The link:https://github.com/apache/ignite-3/tree/main/modules/rest/openapi/openapi.yaml[openapi.yaml] specification file for the version is included with its release.
+
+We recommend that you generate client code in your project language by using an link:https://github.com/OpenAPITools/openapi-generator[OpenAPI code generator]. Below is the example of how you can do this for a Java project.
+
+== Example Java Project Configuration
+
+1. Add an link:https://github.com/OpenAPITools/openapi-generator/tree/master/modules/openapi-generator-maven-plugin[open api generator] maven plugin to your project's pom.xml.
++
+[source,xml]
+----
+<plugin>
+  <groupId>org.openapitools</groupId>
+  <artifactId>openapi-generator-maven-plugin</artifactId>
+  <version>${maven.openapi.plugin.version}</version>
+  <executions>
+    <execution>
+      <goals>
+        <goal>generate</goal>
+      </goals>
+      <configuration>
+        <inputSpec>https://github.com/apache/ignite-3/tree/main/modules/rest/openapi/openapi.yaml</inputSpec>
+        <generatorName>java</generatorName>
+        <apiPackage>org.apache.ignite.rest.client.api</apiPackage>
+        <invokerPackage>org.apache.ignite.rest.client.invoker</invokerPackage>
+        <modelPackage>org.apache.ignite.rest.client.model</modelPackage>
+        <generateModelTests>false</generateModelTests>
+        <generateApiTests>false</generateApiTests>
+        <languageSpecificPrimitives>true</languageSpecificPrimitives>
+        <configOptions>
+          <openApiNullable>false</openApiNullable>
+          <supportStreaming>false</supportStreaming>
+        </configOptions>
+        <library>okhttp-gson</library>
+      </configuration>
+    </execution>
+  </executions>
+</plugin>
+----
++
+2. Get cluster configuration from your project.
++
+[source,java]
+----
+ApiClient client = Configuration.getDefaultApiClient();
+// Set base URL
+client.setBasePath("http://localhost:10300");
+
+// Get cluster configuration.
+clusterConfigurationApi = new ClusterConfigurationApi(client);
+String configuration = clusterConfigurationApi.getClusterConfiguration();
+----
\ No newline at end of file