celeborn/openapi/openapi-model/pom.xml
Fei Wang d698a69edc
[CELEBORN-1477][CIP-9] Refine the celeborn RESTful APIs
### What changes were proposed in this pull request?

This PR is for [CIP-9 Refine the celeborn RESTful APIs](https://docs.google.com/document/d/1LV2vV-w3XtlbJj2Vi4J77mt4IYCr40-8A_JncZLsHqs/edit?usp=sharing).

We leverage [openapi-generator](https://github.com/OpenAPITools/openapi-generator) to generate the client and model code.

### Why are the changes needed?

Celeborn has implemented RESTful APIs for monitoring and administrative operations on both master and worker endpoints. These APIs enable tasks such as configuration checks, status viewing of master/worker nodes, worker decommissioning/recommissioning, and more. They provide crucial insights and support for DevOps.
The primary concern with the existing API is the response content type, which is `text/plain` rather than the more widely accepted `application/json`. This mismatch makes integration with DevOps tools challenging, as these tools typically require JSON-formatted responses for seamless parsing and automation.
And I also saw the need for REST API evolution in[ Apache Celeborn CLI Proposal](https://cwiki.apache.org/confluence/display/CELEBORN/CIP-7+Celeborn+CLI).

### Does this PR introduce _any_ user-facing change?
This pr introduce  a new API namespace: `/api/v1`. This approach allows us to maintain the current API for compatibility while offering an improved version.

### How was this patch tested?
UT.

Closes #2599 from turboFei/cip_9_openapi.

Lead-authored-by: Fei Wang <fwang12@ebay.com>
Co-authored-by: Fei Wang <cn.feiwang@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
2024-07-11 10:57:00 +08:00

166 lines
6.8 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.celeborn</groupId>
<artifactId>celeborn-parent_${scala.binary.version}</artifactId>
<version>${project.version}</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>celeborn-openapi-model_${scala.binary.version}</artifactId>
<packaging>jar</packaging>
<name>Celeborn OpenApi Model</name>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!--
please keep the schema definitions consistent between master_rest_v1.yaml and worker_rest_v1.yaml
-->
<executions>
<execution>
<id>generate-java-master-model-rest-v1</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<inputSpec>${project.basedir}/../openapi-client/src/main/openapi3/master_rest_v1.yaml</inputSpec>
<output>${project.build.directory}/generated-sources/java</output>
<modelPackage>org.apache.celeborn.rest.v1.model</modelPackage>
<generatorName>java</generatorName>
<skipValidateSpec>true</skipValidateSpec>
<generateApis>false</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<artifactVersion>${project.version}</artifactVersion>
<addCompileSourceRoot>false</addCompileSourceRoot>
<cleanupOutput>true</cleanupOutput>
<skipValidateSpec>true</skipValidateSpec>
<configOptions>
<licenseName>Apache License 2.0</licenseName>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<artifactVersion>${project.version}</artifactVersion>
<dateLibrary>java8</dateLibrary>
<useGzipFeature>true</useGzipFeature>
<library>jersey2</library>
<annotationLibrary>swagger1</annotationLibrary>
</configOptions>
</configuration>
</execution>
<execution>
<id>generate-java-worker-model-rest-v1</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<inputSpec>${project.basedir}/../openapi-client/src/main/openapi3/worker_rest_v1.yaml</inputSpec>
<output>${project.build.directory}/generated-sources/java</output>
<modelPackage>org.apache.celeborn.rest.v1.model</modelPackage>
<generatorName>java</generatorName>
<skipValidateSpec>true</skipValidateSpec>
<generateApis>false</generateApis>
<generateApiTests>false</generateApiTests>
<generateModelTests>false</generateModelTests>
<generateSupportingFiles>false</generateSupportingFiles>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<artifactVersion>${project.version}</artifactVersion>
<addCompileSourceRoot>false</addCompileSourceRoot>
<skipValidateSpec>true</skipValidateSpec>
<configOptions>
<licenseName>Apache License 2.0</licenseName>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<artifactVersion>${project.version}</artifactVersion>
<dateLibrary>java8</dateLibrary>
<useGzipFeature>true</useGzipFeature>
<library>jersey2</library>
<annotationLibrary>swagger1</annotationLibrary>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<goals>
<goal>add-source</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java/src/main/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>