Skip to content

Commit 4203a97

Browse files
Merge pull request #47 from fjtirado/codegen
Passing codegencontext to OpenApiInputSpec
2 parents 320082b + 22fa4d7 commit 4203a97

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorStreamCodeGen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public boolean trigger(CodeGenContext context) throws CodeGenException {
5858
boolean generated = false;
5959

6060
for (final OpenApiSpecInputProvider provider : this.providers) {
61-
for (SpecInputModel inputModel : provider.read()) {
61+
for (SpecInputModel inputModel : provider.read(context)) {
6262
LOGGER.debug("Processing OpenAPI spec input model {}", inputModel);
6363
if (inputModel == null) {
6464
throw new CodeGenException("SpecInputModel from provider " + provider + " is null");

deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiSpecInputProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.io.InputStream;
44
import java.util.List;
55

6+
import io.quarkus.deployment.CodeGenContext;
7+
68
/**
79
* Provider interface for clients to dynamically provide their own OpenAPI specification files.
810
*/
@@ -13,6 +15,6 @@ public interface OpenApiSpecInputProvider {
1315
*
1416
* @return a list of spec files in {@link InputStream} format.
1517
*/
16-
List<SpecInputModel> read();
18+
List<SpecInputModel> read(CodeGenContext context);
1719

1820
}

generation-input/src/main/java/io/quarkiverse/openapi/generator/codegen/ClassPathPetstoreOpenApiSpecInputProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import io.quarkiverse.openapi.generator.deployment.codegen.OpenApiSpecInputProvider;
77
import io.quarkiverse.openapi.generator.deployment.codegen.SpecInputModel;
8+
import io.quarkus.deployment.CodeGenContext;
89

910
/**
1011
* Class used during tests to read the spec PetStore file from an alternative input.
@@ -14,7 +15,7 @@
1415
public class ClassPathPetstoreOpenApiSpecInputProvider implements OpenApiSpecInputProvider {
1516

1617
@Override
17-
public List<SpecInputModel> read() {
18+
public List<SpecInputModel> read(CodeGenContext context) {
1819
return Collections.singletonList(
1920
new SpecInputModel("petstore.json", this.getClass().getResourceAsStream("/specs/petstore.json")));
2021
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<dependency>
6464
<groupId>io.quarkiverse.openapi.generator</groupId>
6565
<artifactId>quarkus-openapi-generator-generation-input</artifactId>
66+
<scope>test</scope>
6667
<version>${project.version}</version>
6768
</dependency>
6869
<dependency>

0 commit comments

Comments
 (0)