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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
cache: 'maven'

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

build_reactive:
name: Build - RESTEasy Reactive
Expand Down Expand Up @@ -79,4 +79,4 @@ jobs:
cache: 'maven'

- name: Build with Maven
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check verify --file pom.xml
run: mvn -Presteasy-reactive '-Dorg.slf4j.simpleLogger.log.org.openapitools=off' -B formatter:validate impsort:check install --file pom.xml
109 changes: 109 additions & 0 deletions server/integration-tests/codestarts/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?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>quarkus-openapi-generator-server-integration-tests-parent</artifactId>
<groupId>io.quarkiverse.openapi.generator</groupId>
<version>3.0.0-lts-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-openapi-generator-server-integration-tests-codestarts</artifactId>
<name>Quarkus - Openapi Generator - Server - Integration Tests - Codestarts</name>

<dependencies>
<dependency>
<groupId>io.quarkiverse.openapi.generator</groupId>
<artifactId>quarkus-openapi-generator-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-testing</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo>${settings.localRepository}</maven.repo>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${failsafe-plugin.version}</version>
<configuration>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
<maven.repo>${settings.localRepository}</maven.repo>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
<configuration>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version> <!-- Adjust the version if needed -->
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<resources>
<resource>
<directory>
${project.basedir}/../runtime/src/main/codestarts/quarkus/openapi-generator-codestart/java
</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build</goal>
<goal>generate-code</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package io.quarkiverse.openapi.server.generator.it;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.devtools.codestarts.quarkus.QuarkusCodestartCatalog;
import io.quarkus.devtools.testing.codestarts.QuarkusCodestartTest;

public class QuarkusOpenAPIGeneratorServerCodestartsTest {

@RegisterExtension
public static QuarkusCodestartTest codestartTest = QuarkusCodestartTest.builder()
.languages(QuarkusCodestartCatalog.Language.JAVA)
.setupStandaloneExtensionTest("io.quarkiverse.openapi.generator:quarkus-openapi-generator-server").build();

@Test
void testContent() throws Throwable {
codestartTest
.assertThatGeneratedFile(QuarkusCodestartCatalog.Language.JAVA, "src/main/resources/application.properties")
.content()
.contains("quarkus.openapi.generator.spec=openapi.yml");
codestartTest
.assertThatGeneratedFile(QuarkusCodestartCatalog.Language.JAVA, "src/main/resources/openapi/openapi.yml")
.content()
.contains("title: Generated API");
}
}
3 changes: 2 additions & 1 deletion server/integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<modules>
<module>reactive</module>
<module>resteasy</module>
<module>codestarts</module>
</modules>

</project>
</project>
20 changes: 20 additions & 0 deletions server/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,26 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>generate-codestart-jar</id>
<phase>generate-resources</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classesDirectory>${project.basedir}/src/main</classesDirectory>
<includes>
<include>codestarts/**</include>
</includes>
<classifier>codestarts</classifier>
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: openapi-generator-server-codestart
ref: openapi-generator-server
type: code
tags: extension-codestart
metadata:
title: OpenAPI Generator Server
description: This codestart generates a simple API with OpenAPI documentation.
related-guide-section: https://docs.quarkiverse.io/quarkus-openapi-generator/dev/server.html
language:
base:
dependencies:
- io.quarkus:quarkus-resteasy
- io.quarkus:quarkus-smallrye-openapi
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{#include readme-header /}

## Requirements

If you do not have added the `io.quarkus:quarkus-smallrye-openapi` extension in your project, add it first:

### SmallRye OpenAPI:

Quarkus CLI:

```bash
quarkus ext add io.quarkus:quarkus-smallrye-openapi
```

Maven:
```bash
./mvnw quarkus:add-extension -Dextensions="io.quarkus:quarkus-smallrye-openapi"
```

Gradle:

```bash
./gradlew addExtension --extensions="io.quarkus:quarkus-smallrye-openapi"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
quarkus:
openapi:
generator:
spec:
openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
openapi: 3.0.3
info:
title: Generated API
version: "1.0"
paths:
/pets:
get:
responses:
200:
description: OK
content:
application/json: { }
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
200:
description: OK
content:
application/json: { }
delete:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
responses:
200:
description: OK
content:
application/json: { }
components:
schemas:
Pet:
properties:
description:
type: string
name:
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "OpenAPI Generator - REST Server Generator"
description: "Provides personalized code generation to get started in a Server project "
artifact: ${project.groupId}:${project.artifactId}:${project.version}
metadata:
keywords:
- "openapi"
- "openapi-generator-server"
- "rest"
- "server"
categories:
- "web"
guide: "https://docs.quarkiverse.io/quarkus-openapi-generator/dev/index.html"
icon-url: "https://raw.githubusercontent.com/quarkiverse/quarkus-openapi-generator/main/docs/modules/ROOT/assets/images/openapi.svg"
status: "preview"
codestart:
name: "openapi-generator-server"
languages:
- "java"
artifact: "io.quarkiverse.openapi.generator:quarkus-openapi-generator-server:codestarts:jar:${project.version}"