-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11638 from phillip-kruger/openapi-store-schema
Added option to save the generated OpenAPI schema document on build.
- Loading branch information
Showing
5 changed files
with
148 additions
and
5 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
36 changes: 36 additions & 0 deletions
36
...ment/src/test/java/io/quarkus/smallrye/openapi/test/jaxrs/OpenApiStoreSchemaTestCase.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,36 @@ | ||
package io.quarkus.smallrye.openapi.test.jaxrs; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.openapi.runtime.io.Format; | ||
|
||
public class OpenApiStoreSchemaTestCase { | ||
|
||
private static String directory = "target/generated/jax-rs/"; | ||
private static final String OPEN_API_DOT = "openapi."; | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(OpenApiResource.class, ResourceBean.class) | ||
.addAsResource(new StringAsset("quarkus.smallrye-openapi.store-schema-directory=" + directory), | ||
"application.properties")); | ||
|
||
@Test | ||
public void testOpenApiPathAccessResource() { | ||
Path json = Paths.get(directory, OPEN_API_DOT + Format.JSON.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(json)); | ||
Path yaml = Paths.get(directory, OPEN_API_DOT + Format.YAML.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(yaml)); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ent/src/test/java/io/quarkus/smallrye/openapi/test/spring/OpenApiStoreSchemaTestCase.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,36 @@ | ||
package io.quarkus.smallrye.openapi.test.spring; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.openapi.runtime.io.Format; | ||
|
||
public class OpenApiStoreSchemaTestCase { | ||
|
||
private static String directory = "target/generated/spring/"; | ||
private static final String OPEN_API_DOT = "openapi."; | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(OpenApiController.class) | ||
.addAsResource(new StringAsset("quarkus.smallrye-openapi.store-schema-directory=" + directory), | ||
"application.properties")); | ||
|
||
@Test | ||
public void testOpenApiPathAccessResource() { | ||
Path json = Paths.get(directory, OPEN_API_DOT + Format.JSON.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(json)); | ||
Path yaml = Paths.get(directory, OPEN_API_DOT + Format.YAML.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(yaml)); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ment/src/test/java/io/quarkus/smallrye/openapi/test/vertx/OpenApiStoreSchemaTestCase.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,36 @@ | ||
package io.quarkus.smallrye.openapi.test.vertx; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.smallrye.openapi.runtime.io.Format; | ||
|
||
public class OpenApiStoreSchemaTestCase { | ||
|
||
private static String directory = "target/generated/vertx/"; | ||
private static final String OPEN_API_DOT = "openapi."; | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(OpenApiRoute.class) | ||
.addAsResource(new StringAsset("quarkus.smallrye-openapi.store-schema-directory=" + directory), | ||
"application.properties")); | ||
|
||
@Test | ||
public void testOpenApiPathAccessResource() { | ||
Path json = Paths.get(directory, OPEN_API_DOT + Format.JSON.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(json)); | ||
Path yaml = Paths.get(directory, OPEN_API_DOT + Format.YAML.toString().toLowerCase()); | ||
Assertions.assertTrue(Files.exists(yaml)); | ||
} | ||
} |