Skip to content

Commit 4171bf9

Browse files
committed
Add codestarts to server extension - issue #1021
Add codestart to server extension - issue #1021 Adding codestarter to server extension - issue #1021 minor fixes and tests requested in PR Test update and final touches to codestart server extension Codestart test adjustments Adjust codestarts Add deps version Use install instead Add codestart for the server extension - issue #1021 Adding codestarts to server extension - issue #1021 Adding codestarts to server extension - issue #1021
1 parent b243d0e commit 4171bf9

File tree

12 files changed

+1466
-3
lines changed

12 files changed

+1466
-3
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
cache: 'maven'
5151

5252
- name: Build with Maven
53-
run: mvn '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
53+
run: mvn '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check install --file pom.xml
5454

5555
build_reactive:
5656
name: Build - RESTEasy Reactive
@@ -79,4 +79,4 @@ jobs:
7979
cache: 'maven'
8080

8181
- name: Build with Maven
82-
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
82+
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check install --file pom.xml

docs/modules/ROOT/pages/includes/quarkus-openapi-generator_quarkus.adoc

Lines changed: 1199 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<parent>
5+
<artifactId>quarkus-openapi-generator-server-integration-tests-parent</artifactId>
6+
<groupId>io.quarkiverse.openapi.generator</groupId>
7+
<version>3.0.0-SNAPSHOT</version>
8+
<relativePath>../pom.xml</relativePath>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>quarkus-openapi-generator-server-integration-tests-codestarts</artifactId>
13+
<name>Quarkus - Openapi Generator - Server - Integration Tests - Codestarts</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.quarkiverse.openapi.generator</groupId>
18+
<artifactId>quarkus-openapi-generator-server</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>io.quarkus</groupId>
23+
<artifactId>quarkus-devtools-testing</artifactId>
24+
<scope>test</scope>
25+
</dependency>
26+
</dependencies>
27+
28+
<build>
29+
<pluginManagement>
30+
<plugins>
31+
<plugin>
32+
<groupId>io.quarkus</groupId>
33+
<artifactId>quarkus-maven-plugin</artifactId>
34+
<version>${quarkus.version}</version>
35+
</plugin>
36+
<plugin>
37+
<artifactId>maven-surefire-plugin</artifactId>
38+
<version>${version.surefire.plugin}</version>
39+
<configuration>
40+
<systemPropertyVariables>
41+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
42+
<maven.home>${maven.home}</maven.home>
43+
<maven.repo>${settings.localRepository}</maven.repo>
44+
</systemPropertyVariables>
45+
</configuration>
46+
</plugin>
47+
<plugin>
48+
<artifactId>maven-failsafe-plugin</artifactId>
49+
<version>${failsafe-plugin.version}</version>
50+
<configuration>
51+
<systemPropertyVariables>
52+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
53+
<maven.home>${maven.home}</maven.home>
54+
<maven.repo>${settings.localRepository}</maven.repo>
55+
</systemPropertyVariables>
56+
</configuration>
57+
</plugin>
58+
<plugin>
59+
<artifactId>maven-compiler-plugin</artifactId>
60+
<version>${compiler-plugin.version}</version>
61+
<configuration>
62+
<compilerArgs>
63+
<arg>-parameters</arg>
64+
</compilerArgs>
65+
</configuration>
66+
</plugin>
67+
</plugins>
68+
</pluginManagement>
69+
<plugins>
70+
<plugin>
71+
<groupId>org.apache.maven.plugins</groupId>
72+
<artifactId>maven-resources-plugin</artifactId>
73+
<version>3.3.1</version> <!-- Adjust the version if needed -->
74+
<executions>
75+
<execution>
76+
<id>copy-resources</id>
77+
<phase>generate-resources</phase>
78+
<goals>
79+
<goal>copy-resources</goal>
80+
</goals>
81+
<configuration>
82+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
83+
<resources>
84+
<resource>
85+
<directory>
86+
${project.basedir}/../runtime/src/main/codestarts/quarkus/openapi-generator-codestart/java
87+
</directory>
88+
<filtering>false</filtering>
89+
</resource>
90+
</resources>
91+
</configuration>
92+
</execution>
93+
</executions>
94+
</plugin>
95+
<plugin>
96+
<groupId>io.quarkus</groupId>
97+
<artifactId>quarkus-maven-plugin</artifactId>
98+
<executions>
99+
<execution>
100+
<goals>
101+
<goal>build</goal>
102+
<goal>generate-code</goal>
103+
</goals>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
</plugins>
108+
</build>
109+
</project>

server/integration-tests/codestarts/src/main/resources/application.properties

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package io.quarkiverse.openapi.server.generator.it;
2+
3+
import org.junit.jupiter.api.Test;
4+
import org.junit.jupiter.api.extension.RegisterExtension;
5+
6+
import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog;
7+
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest;
8+
9+
public class QuarkusOpenAPIGeneratorServerCodestartsTest {
10+
11+
@RegisterExtension
12+
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder()
13+
.languages(QuarkusCodestartCatalog.Language.JAVA)
14+
.setupStandaloneExtensionTest("io.quarkiverse.openapi.generator:quarkus-openapi-generator-server").build();
15+
16+
@Test
17+
void testContent() throws Throwable {
18+
codestartTest
19+
.assertThatGeneratedFile(QuarkusCodestartCatalog.Language.JAVA, "src/main/resources/application.properties")
20+
.content()
21+
.contains("quarkus.openapi.generator.spec=openapi.yml");
22+
codestartTest
23+
.assertThatGeneratedFile(QuarkusCodestartCatalog.Language.JAVA, "src/main/resources/openapi/openapi.yml")
24+
.content()
25+
.contains("title: Generated API");
26+
}
27+
}

server/integration-tests/pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<modules>
1717
<module>reactive</module>
1818
<module>resteasy</module>
19+
<module>codestarts</module>
1920
</modules>
2021

21-
</project>
22+
</project>

server/runtime/pom.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@
5959
</execution>
6060
</executions>
6161
</plugin>
62+
<plugin>
63+
<artifactId>maven-jar-plugin</artifactId>
64+
<executions>
65+
<execution>
66+
<id>generate-codestart-jar</id>
67+
<phase>generate-resources</phase>
68+
<goals>
69+
<goal>jar</goal>
70+
</goals>
71+
<configuration>
72+
<classesDirectory>${project.basedir}/src/main</classesDirectory>
73+
<includes>
74+
<include>codestarts/**</include>
75+
</includes>
76+
<classifier>codestarts</classifier>
77+
<skipIfEmpty>true</skipIfEmpty>
78+
</configuration>
79+
</execution>
80+
</executions>
81+
</plugin>
6282
</plugins>
6383
</build>
6484
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: openapi-generator-server
2+
ref: openapi-generator-server
3+
type: code
4+
tags: extension-codestart
5+
metadata:
6+
title: OpenAPI Generator Codestart - Server Extension
7+
description: This codestart generates a simple API with OpenAPI documentation.
8+
related-guide-section: https://docs.quarkiverse.io/quarkus-openapi-generator/dev/server.html
9+
language:
10+
base:
11+
data:
12+
resource:
13+
class-name: YourResource
14+
path: "/your-api"
15+
dependencies:
16+
- io.quarkus:quarkus-resteasy
17+
- io.quarkus:quarkus-smallrye-openapi
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{#include readme-header /}
2+
3+
## Requirements
4+
5+
If you do not have added the `io.quarkus:quarkus-smallrye-openapi` extension in your project, add it first:
6+
7+
### SmallRye OpenAPI:
8+
9+
Quarkus CLI:
10+
11+
```bash
12+
quarkus ext add io.quarkus:quarkus-smallrye-openapi
13+
```
14+
15+
Maven:
16+
```bash
17+
./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-smallrye-openapi"
18+
```
19+
20+
Gradle:
21+
22+
```bash
23+
./gradlew addExtension --extensions="io.quarkus:quarkus-smallrye-openapi"
24+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
quarkus:
2+
openapi:
3+
generator:
4+
spec:
5+
openapi.yml

0 commit comments

Comments
 (0)