You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2021/01/13 14:38:35 UTC

[iotdb] branch openapi updated: add openapi

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

hxd pushed a commit to branch openapi
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/openapi by this push:
     new b21e369  add openapi
b21e369 is described below

commit b21e3694e3e34c70c0cc7c9e9157222fd487c7c8
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Wed Jan 13 22:38:03 2021 +0800

    add openapi
---
 openapi/java-rest/pom.xml                 |  37 +++++
 openapi/java-rest/src/main/java/Test.java |   1 +
 openapi/pom.xml                           | 222 +++++++++++++++++++++---------
 3 files changed, 192 insertions(+), 68 deletions(-)

diff --git a/openapi/java-rest/pom.xml b/openapi/java-rest/pom.xml
new file mode 100644
index 0000000..fbe75c9
--- /dev/null
+++ b/openapi/java-rest/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.iotdb</groupId>
+        <artifactId>openapi</artifactId>
+        <version>0.12.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>java-rest</artifactId>
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+    </properties>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.4</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${basedir}/src/labs/java</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/openapi/java-rest/src/main/java/Test.java b/openapi/java-rest/src/main/java/Test.java
new file mode 100644
index 0000000..0ee28d1
--- /dev/null
+++ b/openapi/java-rest/src/main/java/Test.java
@@ -0,0 +1 @@
+/*  * 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 r [...]
\ No newline at end of file
diff --git a/openapi/pom.xml b/openapi/pom.xml
index e395a4a..36107fb 100644
--- a/openapi/pom.xml
+++ b/openapi/pom.xml
@@ -1,63 +1,69 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <parent>
-    <artifactId>iotdb-parent</artifactId>
-    <groupId>org.apache.iotdb</groupId>
-    <version>0.12.0-SNAPSHOT</version>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
-  <packaging>pom</packaging>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>iotdb-parent</artifactId>
+        <groupId>org.apache.iotdb</groupId>
+        <version>0.12.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>pom</packaging>
+    <modules>
+        <module>java-rest</module>
+    </modules>
+    <artifactId>openapi</artifactId>
+    <properties>
+        <swagger-codegen-maven-plugin-version>3.0.24</swagger-codegen-maven-plugin-version>
+        <resteasy-version>3.1.3.Final</resteasy-version>
+        <openapi-generator-version>5.0.0</openapi-generator-version>
+    </properties>
+    <build>
+        <plugins>
 
-  <artifactId>openapi</artifactId>
-  <properties>
-    <swagger-codegen-maven-plugin-version>3.0.24</swagger-codegen-maven-plugin-version>
-    <resteasy-version>3.1.3.Final</resteasy-version>
-    <swagger-core-version>2.0.0</swagger-core-version>
-  </properties>
-
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>io.swagger.codegen.v3</groupId>
-        <artifactId>swagger-codegen-maven-plugin</artifactId>
-        <version>${swagger-codegen-maven-plugin-version}</version>
-        <executions>
-          <execution>
-            <goals>
-              <goal>generate</goal>
-            </goals>
-            <configuration>
-              <!-- use `java -jar swagger-codegen-cli-3.0.24.jar config-help -l java`
-              to see configuration options-->
-              <inputSpec>${project.basedir}/src/main/openapi3/iotdb-rest.yaml</inputSpec>
-              <language>java</language>
-              <output>${project.build.directory}/generated-sources/java</output>
-              <apiPackage>org.apache.iotdb.openapi.gen.handler</apiPackage>
-              <modelPackage>org.apache.iotdb.openapi.gen.model</modelPackage>
-              <invokerPackage>org.apache.iotdb.openapi.gen.invoker</invokerPackage>
-              <addCompileSourceRoot>false</addCompileSourceRoot>
-              <configOptions>
-                <licenseName>Apache License 2.0</licenseName>
-                <groupId>org.apache.iotdb</groupId>
-                <artifactId>iotdb-rest-service</artifactId>
-                <artifactVersion>${project.version}</artifactVersion>
-                <serverPort>5667</serverPort>
-                <dateLibrary>java8</dateLibrary>
-                <useGzipFeature>true</useGzipFeature>
-<!--                <library>resteasy</library>-->
-              </configOptions>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-
-    </plugins>
-  </build>
-
-  <!--
+        </plugins>
+    </build>
+    <!--  <properties>-->
+    <!--    <swagger-codegen-maven-plugin-version>3.0.24</swagger-codegen-maven-plugin-version>-->
+    <!--    <resteasy-version>3.1.3.Final</resteasy-version>-->
+    <!--    <swagger-core-version>2.0.0</swagger-core-version>-->
+    <!--  </properties>-->
+    <!--  <build>-->
+    <!--    <plugins>-->
+    <!--      <plugin>-->
+    <!--        <groupId>io.swagger.codegen.v3</groupId>-->
+    <!--        <artifactId>swagger-codegen-maven-plugin</artifactId>-->
+    <!--        <version>${swagger-codegen-maven-plugin-version}</version>-->
+    <!--        <executions>-->
+    <!--          <execution>-->
+    <!--            <goals>-->
+    <!--              <goal>generate</goal>-->
+    <!--            </goals>-->
+    <!--            <configuration>-->
+    <!--              &lt;!&ndash; use `java -jar swagger-codegen-cli-3.0.24.jar config-help -l java`-->
+    <!--              to see configuration options&ndash;&gt;-->
+    <!--              <inputSpec>${project.basedir}/src/main/openapi3/iotdb-rest.yaml</inputSpec>-->
+    <!--              <language>java</language>-->
+    <!--              <output>${project.build.directory}/generated-sources/java</output>-->
+    <!--              <apiPackage>org.apache.iotdb.openapi.gen.handler</apiPackage>-->
+    <!--              <modelPackage>org.apache.iotdb.openapi.gen.model</modelPackage>-->
+    <!--              <invokerPackage>org.apache.iotdb.openapi.gen.invoker</invokerPackage>-->
+    <!--              <addCompileSourceRoot>false</addCompileSourceRoot>-->
+    <!--              <configOptions>-->
+    <!--                <licenseName>Apache License 2.0</licenseName>-->
+    <!--                <groupId>org.apache.iotdb</groupId>-->
+    <!--                <artifactId>iotdb-rest-service</artifactId>-->
+    <!--                <artifactVersion>${project.version}</artifactVersion>-->
+    <!--                <serverPort>5667</serverPort>-->
+    <!--                <dateLibrary>java8</dateLibrary>-->
+    <!--                <useGzipFeature>true</useGzipFeature>-->
+    <!--&lt;!&ndash;                <library>resteasy</library>&ndash;&gt;-->
+    <!--              </configOptions>-->
+    <!--            </configuration>-->
+    <!--          </execution>-->
+    <!--        </executions>-->
+    <!--      </plugin>-->
+    <!--    </plugins>-->
+    <!--  </build>-->
+    <!--
   <dependencies>
     <dependency>
       <groupId>io.swagger.core.v3</groupId>
@@ -112,14 +118,94 @@
     </dependency>
   </dependencies>
 -->
-  <profiles>
-    <profile>
-      <id>java-rest</id>
-      <modules>
-        <module>target/generated-sources/java</module>
-      </modules>
-    </profile>
-
-  </profiles>
+<!--    <profiles>-->
+<!--        <profile>-->
+<!--            <id>java-rest</id>-->
+<!--            <modules>-->
+<!--                <module>target/generated-sources/java</module>-->
+<!--            </modules>-->
+<!--        </profile>-->
+<!--    </profiles>-->
+    <profiles>
+        <profile>
+            <id>openapi-generation</id>
+            <activation>
+                <file>
+                    <exists>src/main/openapi3</exists>
+                </file>
+            </activation>
+            <properties>
+                <thrift.exec.absolute.path>${project.build.directory}/tools/${thrift.executable}</thrift.exec.absolute.path>
+            </properties>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.openapitools</groupId>
+                        <artifactId>openapi-generator-maven-plugin</artifactId>
+                        <version>${openapi-generator-version}</version>
+                        <executions>
+                            <execution>
+                                <id>generate-java-rest-codes</id>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <inputSpec>${project.basedir}/src/main/openapi3/iotdb-rest.yaml</inputSpec>
+                                    <output>${project.build.directory}/generated-sources/java</output>
+                                    <apiPackage>org.apache.iotdb.openapi.gen.handler</apiPackage>
+                                    <modelPackage>org.apache.iotdb.openapi.gen.model</modelPackage>
+                                    <invokerPackage>org.apache.iotdb.openapi.gen.invoker</invokerPackage>
+                                    <generatorName>jaxrs-jersey</generatorName>
+                                    <groupId>org.apache.iotdb</groupId>
+                                    <artifactId>iotdb-rest-service</artifactId>
+                                    <artifactVersion>${project.version}</artifactVersion>
+                                    <addCompileSourceRoot>true</addCompileSourceRoot>
+                                    <configOptions>
+                                        <licenseName>Apache License 2.0</licenseName>
+                                        <groupId>org.apache.iotdb</groupId>
+                                        <artifactId>iotdb-rest-service</artifactId>
+                                        <artifactVersion>${project.version}</artifactVersion>
+                                        <serverPort>5667</serverPort>
+                                        <dateLibrary>java8</dateLibrary>
+                                        <useGzipFeature>true</useGzipFeature>
+                                        <!-- sourceFolder is a relative folder -->
+                                        <sourceFolder>src/gen/java</sourceFolder>
+                                    </configOptions>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>generate-go-rest-codes</id>
+                                <goals>
+                                    <goal>generate</goal>
+                                </goals>
+                                <configuration>
+                                    <inputSpec>${project.basedir}/src/main/openapi3/iotdb-rest.yaml</inputSpec>
+                                    <output>${project.build.directory}/generated-sources/go</output>
+                                    <apiPackage>org.apache.iotdb.openapi.gen.handler</apiPackage>
+                                    <modelPackage>org.apache.iotdb.openapi.gen.model</modelPackage>
+                                    <invokerPackage>org.apache.iotdb.openapi.gen.invoker</invokerPackage>
+                                    <generatorName>go-server</generatorName>
+                                    <groupId>org.apache.iotdb</groupId>
+                                    <artifactId>iotdb-rest-service</artifactId>
+                                    <artifactVersion>${project.version}</artifactVersion>
+                                    <addCompileSourceRoot>false</addCompileSourceRoot>
+                                    <configOptions>
+                                        <licenseName>Apache License 2.0</licenseName>
+                                        <packageName>org.apache.iotdb</packageName>
+                                        <packageName>org.apache.iotdb.rest</packageName>
+                                        <packageVersion>${project.version}</packageVersion>
+                                        <serverPort>5667</serverPort>
+                                        <useGzipFeature>true</useGzipFeature>
+                                        <!-- sourceFolder is a relative folder -->
+                                        <sourceFolder>gen</sourceFolder>
+                                    </configOptions>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
 
-</project>
\ No newline at end of file
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>