Migrated to offical OpenAPI Maven plugin
parent
79af35336c
commit
79c6c7d812
|
|
@ -92,11 +92,20 @@
|
|||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- OpenAPI/Swagger Annoations for documenting the RESTful API
|
||||
<!--OpenAPI/Swagger Annoations for documenting the RESTful API-->
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-jaxrs2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>-->
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- Dependencies for log4j 2 -->
|
||||
<dependency>
|
||||
|
|
@ -374,7 +383,8 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
<!-- <plugin>
|
||||
<groupId>io.openapitools.swagger</groupId>
|
||||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
|
|
@ -388,18 +398,50 @@
|
|||
<resourcePackage>org.libreccm.api.admin.security.dto</resourcePackage>
|
||||
</resourcePackages>
|
||||
<outputDirectory>${project.basedir}/src/site/resources</outputDirectory>
|
||||
<outputDirectory>${project.build.directory}/generated-resources/openapi</outputDirectory>
|
||||
<outputFilename>ccm-core-api</outputFilename>
|
||||
<outputFormats>JSON</outputFormats>
|
||||
<prettyPrint>true</prettyPrint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>-->
|
||||
|
||||
<plugin>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<resourcePackages>
|
||||
<package>org.libreccm.api</package>
|
||||
<package>org.libreccm.api.admin</package>
|
||||
<package>org.libreccm.api.admin.categorization</package>
|
||||
<package>org.libreccm.api.admin.categorization.dto</package>
|
||||
<package>org.libreccm.api.admin.configuration</package>
|
||||
<package>org.libreccm.api.admin.security</package>
|
||||
<package>org.libreccm.api.admin.security.dto</package>
|
||||
</resourcePackages>
|
||||
<!--<outputDirectory>${project.basedir}/src/site/resources</outputDirectory>-->
|
||||
<outputPath>${project.build.directory}/generated-resources/openapi</outputPath>
|
||||
<outputFileName>ccm-core-api</outputFileName>
|
||||
<outputFormat>JSONANDYAML</outputFormat>
|
||||
<prettyPrint>TRUE</prettyPrint>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>resolve</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@
|
|||
*/
|
||||
package org.libreccm.api.admin;
|
||||
|
||||
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
|
||||
import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
||||
import io.swagger.v3.oas.annotations.info.Contact;
|
||||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import io.swagger.v3.oas.annotations.info.License;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||
import org.libreccm.api.admin.security.GroupsApi;
|
||||
import org.libreccm.api.admin.security.RolesApi;
|
||||
import org.libreccm.api.admin.security.UsersApi;
|
||||
|
|
@ -12,7 +19,6 @@ import org.libreccm.api.admin.security.UsersApi;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
import org.libreccm.api.CorsFilter;
|
||||
|
|
@ -25,11 +31,35 @@ import org.libreccm.api.admin.sites.SitesApi;
|
|||
import org.libreccm.api.admin.web.CcmApplicationsApi;
|
||||
import org.libreccm.configuration.Configuration;
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@ApplicationPath("/api/admin")
|
||||
@OpenAPIDefinition(
|
||||
info = @Info(
|
||||
title = "ccm-core Admin RESTful API",
|
||||
version = "7.0.0",
|
||||
description = "RESTful API for basic administration tasks",
|
||||
license = @License(name = "LGPL v3"),
|
||||
contact = @Contact(
|
||||
url = "https://www.libreccm.org", email = "info@libreccm.org"
|
||||
)
|
||||
),
|
||||
security = {
|
||||
@SecurityRequirement(
|
||||
name = "ccm-core-admin-security"
|
||||
)
|
||||
}
|
||||
)
|
||||
@SecurityScheme(
|
||||
name = "ccm-core-admin-security",
|
||||
type = SecuritySchemeType.HTTP,
|
||||
scheme = "bearer",
|
||||
bearerFormat = "JWT"
|
||||
)
|
||||
public class AdminApi extends Application {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ package org.libreccm.api.admin;
|
|||
|
||||
import com.arsdigita.util.SystemInformation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.libreccm.core.CoreConstants;
|
||||
import org.libreccm.security.AuthorizationRequired;
|
||||
import org.libreccm.security.RequiresPrivilege;
|
||||
|
|
@ -40,11 +41,16 @@ import javax.ws.rs.core.MediaType;
|
|||
public class SystemInformationApi {
|
||||
|
||||
@GET
|
||||
@Path("/{domainIdentifier}/{path:^[\\w\\-/]+$}")
|
||||
@Path("/")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
@AuthorizationRequired
|
||||
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
|
||||
@Transactional(Transactional.TxType.REQUIRED)
|
||||
@Operation(
|
||||
summary = "Retrieve system information",
|
||||
description = "Returns a JSON object with several informations about "
|
||||
+ "LibreCCM installation"
|
||||
)
|
||||
public SystemInformation getSystemInformation() {
|
||||
return SystemInformation.getInstance();
|
||||
}
|
||||
|
|
|
|||
14
pom.xml
14
pom.xml
|
|
@ -54,6 +54,7 @@
|
|||
|
||||
<!-- Provides basic functionality required by all modules -->
|
||||
<module>ccm-core</module>
|
||||
<module>ccm-core-apiclient</module>
|
||||
|
||||
<!-- Additional modules used by most/all modules (including ccm-core) -->
|
||||
<module>ccm-testutils</module>
|
||||
|
|
@ -103,7 +104,7 @@
|
|||
<module>ccm-cms-archetype-contenttype</module>
|
||||
|
||||
<!--<module>ccm-cms-js</module>-->
|
||||
<module>ccm-core-apiclient</module>
|
||||
|
||||
</modules>
|
||||
|
||||
<reporting>
|
||||
|
|
@ -334,6 +335,11 @@
|
|||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
<version>2.1.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-maven-plugin</artifactId>
|
||||
<version>2.1.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.wildfly.plugins</groupId>
|
||||
<artifactId>wildfly-maven-plugin</artifactId>
|
||||
|
|
@ -733,17 +739,17 @@
|
|||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-jaxrs2</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-jaxrs2-servlet-initializer-v2</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.1.2</version>
|
||||
<version>2.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
|
|
|||
Loading…
Reference in New Issue