-
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 #3362 from jmini/issue2907
[open-api] Consider 'mp.openapi.scan.disable' value when scanning annotations
- Loading branch information
Showing
4 changed files
with
61 additions
and
2 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
38 changes: 38 additions & 0 deletions
38
.../deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiWithConfigTestCase.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,38 @@ | ||
package io.quarkus.smallrye.openapi.test; | ||
|
||
import org.hamcrest.Matchers; | ||
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.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class OpenApiWithConfigTestCase { | ||
private static final String OPEN_API_PATH = "/openapi"; | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(OpenApiResource.class) | ||
.addAsManifestResource("test-openapi.yaml", "openapi.yaml") | ||
.addAsResource(new StringAsset("mp.openapi.scan.disable=true\nmp.openapi.servers=https://api.acme.org/"), | ||
"application.properties")); | ||
|
||
@Test | ||
public void testOpenAPI() { | ||
RestAssured.given().header("Accept", "application/json") | ||
.when().get(OPEN_API_PATH) | ||
.then() | ||
.header("Content-Type", "application/json;charset=UTF-8") | ||
.body("openapi", Matchers.startsWith("3.0")) | ||
.body("info.title", Matchers.equalTo("Test OpenAPI")) | ||
.body("info.description", Matchers.equalTo("Some description")) | ||
.body("info.version", Matchers.equalTo("4.2")) | ||
.body("servers[0].url", Matchers.equalTo("https://api.acme.org/")) | ||
.body("paths", Matchers.hasKey("/openapi")) | ||
.body("paths", Matchers.not(Matchers.hasKey("/resource"))); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
extensions/smallrye-openapi/deployment/src/test/resources/test-openapi.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,12 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Test OpenAPI | ||
description: Some description | ||
version: 4.2 | ||
paths: | ||
/openapi: | ||
get: | ||
operationId: someOperation | ||
responses: | ||
200: | ||
description: Ok |