-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add generatemodels and generateapis options
- Loading branch information
1 parent
aa9f471
commit 038f272
Showing
15 changed files
with
321 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?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-integration-tests</artifactId> | ||
<groupId>io.quarkiverse.openapi.generator</groupId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-openapi-generator-it-generate-flags</artifactId> | ||
<name>Quarkus - Openapi Generator - Integration Tests - Client - Generate Flags</name> | ||
<description>Example project for usage of the generate-models and generate-apis properties</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkiverse.openapi.generator</groupId> | ||
<artifactId>quarkus-openapi-generator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-hibernate-validator</artifactId> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<extensions>true</extensions> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
<goal>generate-code</goal> | ||
<goal>generate-code-tests</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>native-image</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path> | ||
${project.build.directory}/${project.build.finalName}-runner | ||
</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager | ||
</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<properties> | ||
<quarkus.package.type>native</quarkus.package.type> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
60 changes: 60 additions & 0 deletions
60
client/integration-tests/generate-flags/src/main/openapi/generate_apis_false.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: Test API | ||
version: "1.0" | ||
paths: | ||
/{pathParam}: | ||
get: | ||
tags: | ||
- NonExistentEndpoint | ||
operationId: test | ||
parameters: | ||
- name: pathParam | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
minimum: 5 | ||
- name: headerParam | ||
in: header | ||
required: false | ||
schema: | ||
type: integer | ||
maximum: 5 | ||
- name: cookieParam | ||
in: cookie | ||
required: true | ||
schema: | ||
type: string | ||
minLength: 10 | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
components: | ||
schemas: | ||
ExistentObject: | ||
type: object | ||
description: Some object not to be validated | ||
required: | ||
- id | ||
- name | ||
- size | ||
properties: | ||
id: | ||
type: integer | ||
minimum: 1 | ||
maximum: 100 | ||
name: | ||
type: string | ||
pattern: "[a-zA-Z]*" | ||
minLength: 1 | ||
maxLength: 10 | ||
size: | ||
type: number | ||
minimum: 1.0 | ||
maximum: 10.0 |
60 changes: 60 additions & 0 deletions
60
client/integration-tests/generate-flags/src/main/openapi/generate_models_false.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
openapi: 3.0.3 | ||
info: | ||
title: Test API | ||
version: "1.0" | ||
paths: | ||
/{pathParam}: | ||
get: | ||
tags: | ||
- ExistentEndpoint | ||
operationId: test | ||
parameters: | ||
- name: pathParam | ||
in: path | ||
required: true | ||
schema: | ||
type: string | ||
minimum: 5 | ||
- name: headerParam | ||
in: header | ||
required: false | ||
schema: | ||
type: integer | ||
maximum: 5 | ||
- name: cookieParam | ||
in: cookie | ||
required: true | ||
schema: | ||
type: string | ||
minLength: 10 | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
components: | ||
schemas: | ||
NonExistentObject: | ||
type: object | ||
description: Some object not to be validated | ||
required: | ||
- id | ||
- name | ||
- size | ||
properties: | ||
id: | ||
type: integer | ||
minimum: 1 | ||
maximum: 100 | ||
name: | ||
type: string | ||
pattern: "[a-zA-Z]*" | ||
minLength: 1 | ||
maxLength: 10 | ||
size: | ||
type: number | ||
minimum: 1.0 | ||
maximum: 10.0 |
2 changes: 2 additions & 0 deletions
2
client/integration-tests/generate-flags/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
quarkus.openapi-generator.codegen.spec.generate_models_false_yaml.generate-models = false | ||
quarkus.openapi-generator.codegen.spec.generate_apis_false_yaml.generate-apis = false |
35 changes: 35 additions & 0 deletions
35
...s/generate-flags/src/test/java/io/quarkiverse/openapi/generator/it/GenerateFlagsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package io.quarkiverse.openapi.generator.it; | ||
|
||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
class GenerateFlagsTest { | ||
|
||
@Test | ||
void testEndpointIsInPlace() throws ClassNotFoundException { | ||
Class.forName("org.openapi.quarkus.generate_models_false_yaml.api.ExistentEndpointApi"); | ||
} | ||
|
||
@Test | ||
void testModelIsInPlace() throws ClassNotFoundException { | ||
Class.forName("org.openapi.quarkus.generate_apis_false_yaml.model.ExistentObject"); | ||
} | ||
|
||
@Test | ||
void testEndpointIsNotInPlace() { | ||
Assertions.assertThatThrownBy(() -> { | ||
Class.forName("org.openapi.quarkus.generate_apis_false_yaml.model.NonExistentEndpointApi"); | ||
}).isInstanceOf(ClassNotFoundException.class); | ||
} | ||
|
||
@Test | ||
void testModelIsNotInPlace() { | ||
Assertions.assertThatThrownBy(() -> { | ||
Class.forName("org.openapi.quarkus.generate_models_false_yaml.api.NonExistentObject"); | ||
}).isInstanceOf(ClassNotFoundException.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
APIs are generated by default. To disable them set `generate-apis` to false: | ||
|
||
[source,properties] | ||
---- | ||
quarkus.openapi-generator.codegen.spec.my_openapi_yaml.generate-apis=false | ||
---- |
Oops, something went wrong.