Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@
<artifactId>quarkus-smallrye-metrics-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi-common-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
Expand Down Expand Up @@ -560,6 +565,11 @@
<artifactId>quarkus-swagger-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-swagger-ui-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-elytron-security</artifactId>
Expand Down
17 changes: 9 additions & 8 deletions docs/src/main/asciidoc/openapi-swaggerui-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc
////

include::./attributes.adoc[]
= {project-name} - Using OpenAPI and Swagger UI

Expand Down Expand Up @@ -204,12 +210,12 @@ public class FruitResourceTest {
Quarkus proposes a `smallrye-openapi` extension compliant with the https://github.com/eclipse/microprofile-open-api/[Eclipse MicroProfile OpenAPI]
specification in order to generate your API https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md[OpenAPI v3 specification].

The first and unique step to do so is to add the `smallrye-openapi` extension to your Quarkus application:
You just need to add the `smallrye-openapi` extension to your Quarkus application:
----
./mvnw quarkus:add-extension -Dextensions="smallrye-openapi"
----

Now we are ready to run our application:
Now, we are ready to run our application:
----
./mvnw compile quarkus:dev
----
Expand Down Expand Up @@ -269,15 +275,10 @@ When building APIs, developers want to test them quickly. https://swagger.io/too
permitting to visualize and interact with your APIs.
The UI is automatically generated from your OpenAPI specification.

Quarkus comes with a `swagger-ui` extension embedding a properly configured Swagger UI page.
The Quarkus `smallrye-openapi` extension comes with a `swagger-ui` extension embedding a properly configured Swagger UI page.

NOTE: Swagger UI is only available when Quarkus is started in dev or test mode.

For this feature to be available, you need to add the `swagger-ui` extension to your Quarkus application:
----
./mvnw quarkus:add-extension -Dextensions="swagger-ui"
----

By default, Swagger UI is accessible at `/swagger-ui`.

You can update this path by setting the `quarkus.swagger-ui.path` property in your `application.properties`:
Expand Down
6 changes: 6 additions & 0 deletions docs/src/main/asciidoc/openshift-s2i-guide.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
////
This guide is maintained in the main Quarkus repository
and pull requests should be submitted there:
https://github.com/quarkusio/quarkus/tree/master/docs/src/main/asciidoc
////

include::./attributes.adoc[]
= {project-name} - Deploying on OpenShift with S2I

Expand Down
3 changes: 1 addition & 2 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@
<module>resteasy</module>
<module>resteasy-jsonb</module>
<module>smallrye-rest-client</module>
<module>smallrye-openapi-common</module>
<module>smallrye-openapi</module>

<!-- Swagger UI-->
<module>swagger-ui</module>

<!-- Reactive -->
Expand Down
56 changes: 56 additions & 0 deletions extensions/smallrye-openapi-common/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 Red Hat, Inc.
~
~ Licensed 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">
<parent>
<artifactId>quarkus-smallrye-openapi-common-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-smallrye-openapi-common-deployment</artifactId>
<name>Quarkus - SmallRye OpenAPI - Common - Deployment</name>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2019 Red Hat, Inc.
*
* Licensed 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.
*/
package io.quarkus.resteasy.smallrye.openapi.common.deployment;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;

@ConfigRoot(name = "smallrye-openapi")
public final class SmallRyeOpenApiConfig {
/**
* The path at which to register the OpenAPI Servlet.
*/
@ConfigItem(defaultValue = "/openapi")
public String path;
}
36 changes: 36 additions & 0 deletions extensions/smallrye-openapi-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2018 Red Hat, Inc.
~
~ Licensed 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">
<parent>
<artifactId>quarkus-build-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-smallrye-openapi-common-parent</artifactId>
<name>Quarkus - SmallRye OpenAPI - Common</name>
<packaging>pom</packaging>
<modules>
<module>deployment</module>
</modules>

</project>
8 changes: 8 additions & 0 deletions extensions/smallrye-openapi/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi-common-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-swagger-ui-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
import io.quarkus.deployment.builditem.substrate.ReflectiveHierarchyBuildItem;
import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.resteasy.deployment.ResteasyJaxrsConfig;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.resteasy.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig;
import io.quarkus.smallrye.openapi.runtime.OpenApiDocumentProducer;
import io.quarkus.smallrye.openapi.runtime.OpenApiServlet;
import io.quarkus.smallrye.openapi.runtime.SmallRyeOpenApiTemplate;
Expand Down Expand Up @@ -93,15 +92,6 @@ public class SmallRyeOpenApiProcessor {

SmallRyeOpenApiConfig openapi;

@ConfigRoot(name = "smallrye-openapi")
public static final class SmallRyeOpenApiConfig {
/**
* The path at which to register the OpenAPI Servlet.
*/
@ConfigItem(defaultValue = "/openapi")
public String path;
}

List<HotDeploymentConfigFileBuildItem> configFiles() {
return Stream.of(META_INF_OPENAPI_YAML, WEB_INF_CLASSES_META_INF_OPENAPI_YAML,
META_INF_OPENAPI_YML, WEB_INF_CLASSES_META_INF_OPENAPI_YML,
Expand Down
4 changes: 4 additions & 0 deletions extensions/smallrye-openapi/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion extensions/swagger-ui/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi-deployment</artifactId>
<artifactId>quarkus-smallrye-openapi-common-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
import io.quarkus.deployment.index.ClassPathArtifactResolver;
import io.quarkus.deployment.index.ResolvedArtifact;
import io.quarkus.deployment.util.FileUtil;
import io.quarkus.resteasy.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor;
import io.quarkus.swaggerui.runtime.SwaggerUiTemplate;
import io.quarkus.undertow.deployment.ServletExtensionBuildItem;

Expand All @@ -46,11 +46,11 @@ public class SwaggerUiProcessor {
private static final String TEMP_DIR_PREFIX = "quarkus-swagger-ui_" + System.nanoTime();

/**
* The configuration for swagger-ui.
* The configuration for Swagger UI.
*/
private SwaggerUiConfig swaggerUiConfig;
SwaggerUiConfig swaggerUiConfig;

SmallRyeOpenApiProcessor.SmallRyeOpenApiConfig openapi;
SmallRyeOpenApiConfig openapi;

private static String cachedOpenAPIPath;
private static String cachedDirectory;
Expand Down
4 changes: 0 additions & 4 deletions extensions/swagger-ui/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
</dependencies>

<build>
Expand Down