diff --git a/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server.adoc b/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server.adoc index 8410f0a8c..9955fd047 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server.adoc @@ -7,7 +7,89 @@ h|[.header-title]##Configuration property## h|Type h|Default -3+|No configuration properties found. +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-spec]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-spec[`quarkus.openapi.generator.spec`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.spec+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The OpenAPI specification filename. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_SPEC+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_SPEC+++` +endif::add-copy-button-to-env-var[] +-- +|string +| + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-input-base-dir]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-input-base-dir[`quarkus.openapi.generator.input-base-dir`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.input-base-dir+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The input base dir where the OpenAPI specification is. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_INPUT_BASE_DIR+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_INPUT_BASE_DIR+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`src/main/resources/openapi` + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-reactive]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-reactive[`quarkus.openapi.generator.reactive`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.reactive+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +Whether it must generate with reactive code. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_REACTIVE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_REACTIVE+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-base-package]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-base-package[`quarkus.openapi.generator.base-package`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.base-package+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The base package to be used to generated sources. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_BASE_PACKAGE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_BASE_PACKAGE+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`io.apicurio.api` |=== diff --git a/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server_quarkus.openapi.adoc b/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server_quarkus.openapi.adoc index 8410f0a8c..9955fd047 100644 --- a/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server_quarkus.openapi.adoc +++ b/docs/modules/ROOT/pages/includes/quarkus-openapi-generator-server_quarkus.openapi.adoc @@ -7,7 +7,89 @@ h|[.header-title]##Configuration property## h|Type h|Default -3+|No configuration properties found. +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-spec]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-spec[`quarkus.openapi.generator.spec`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.spec+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The OpenAPI specification filename. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_SPEC+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_SPEC+++` +endif::add-copy-button-to-env-var[] +-- +|string +| + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-input-base-dir]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-input-base-dir[`quarkus.openapi.generator.input-base-dir`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.input-base-dir+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The input base dir where the OpenAPI specification is. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_INPUT_BASE_DIR+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_INPUT_BASE_DIR+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`src/main/resources/openapi` + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-reactive]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-reactive[`quarkus.openapi.generator.reactive`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.reactive+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +Whether it must generate with reactive code. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_REACTIVE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_REACTIVE+++` +endif::add-copy-button-to-env-var[] +-- +|boolean +|`false` + +a|icon:lock[title=Fixed at build time] [[quarkus-openapi-generator-server_quarkus-openapi-generator-base-package]] [.property-path]##link:#quarkus-openapi-generator-server_quarkus-openapi-generator-base-package[`quarkus.openapi.generator.base-package`]## +ifdef::add-copy-button-to-config-props[] +config_property_copy_button:+++quarkus.openapi.generator.base-package+++[] +endif::add-copy-button-to-config-props[] + + +[.description] +-- +The base package to be used to generated sources. + + +ifdef::add-copy-button-to-env-var[] +Environment variable: env_var_with_copy_button:+++QUARKUS_OPENAPI_GENERATOR_BASE_PACKAGE+++[] +endif::add-copy-button-to-env-var[] +ifndef::add-copy-button-to-env-var[] +Environment variable: `+++QUARKUS_OPENAPI_GENERATOR_BASE_PACKAGE+++` +endif::add-copy-button-to-env-var[] +-- +|string +|`io.apicurio.api` |=== diff --git a/docs/modules/ROOT/pages/server.adoc b/docs/modules/ROOT/pages/server.adoc index 33d67a5b0..30dcac7fe 100644 --- a/docs/modules/ROOT/pages/server.adoc +++ b/docs/modules/ROOT/pages/server.adoc @@ -16,3 +16,7 @@ include::includes/want-to-contribute.adoc[] == Getting Started include::./includes/server-getting-started.adoc[leveloffset=+1, opts=optional] + +== Configuration Properties + +include::./includes/quarkus-openapi-generator-server.adoc[opts=optional, leveloffset=+1] diff --git a/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/CodegenConfig.java b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/CodegenConfig.java index 19f5d9a5f..69b474d57 100755 --- a/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/CodegenConfig.java +++ b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/CodegenConfig.java @@ -6,7 +6,7 @@ @ConfigRoot(phase = ConfigPhase.BUILD_TIME) @ConfigMapping(prefix = CodegenConfig.CODEGEN_TIME_CONFIG_PREFIX) -public interface CodegenConfig { +public interface CodegenConfig extends ServerCodegenConfig { String CODEGEN_TIME_CONFIG_PREFIX = "quarkus.openapi.generator"; String CODEGEN_BASE_PACKAGE = CODEGEN_TIME_CONFIG_PREFIX + ".base-package"; diff --git a/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/ServerCodegenConfig.java b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/ServerCodegenConfig.java new file mode 100644 index 000000000..e7aa8454e --- /dev/null +++ b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/ServerCodegenConfig.java @@ -0,0 +1,33 @@ +package io.quarkiverse.openapi.server.generator.deployment; + +import java.util.Optional; + +import io.smallrye.config.WithDefault; + +public interface ServerCodegenConfig { + + String DEFAULT_PACKAGE = "io.apicurio.api"; + + /** + * The OpenAPI specification filename. + */ + Optional spec(); + + /** + * The input base dir where the OpenAPI specification is. + */ + @WithDefault("src/main/resources/openapi") + Optional inputBaseDir(); + + /** + * Whether it must generate with reactive code. + */ + @WithDefault("false") + boolean reactive(); + + /** + * The base package to be used to generated sources. + */ + @WithDefault(DEFAULT_PACKAGE) + Optional basePackage(); +} diff --git a/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/codegen/ApicurioCodegenWrapper.java b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/codegen/ApicurioCodegenWrapper.java index 2aac2a5af..eef7cf10b 100755 --- a/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/codegen/ApicurioCodegenWrapper.java +++ b/server/deployment/src/main/java/io/quarkiverse/openapi/server/generator/deployment/codegen/ApicurioCodegenWrapper.java @@ -2,6 +2,7 @@ import static io.quarkiverse.openapi.server.generator.deployment.CodegenConfig.getBasePackagePropertyName; import static io.quarkiverse.openapi.server.generator.deployment.CodegenConfig.getCodegenReactive; +import static io.quarkiverse.openapi.server.generator.deployment.ServerCodegenConfig.DEFAULT_PACKAGE; import java.io.File; import java.io.FileInputStream; @@ -26,7 +27,6 @@ public class ApicurioCodegenWrapper { private static final Logger log = LoggerFactory.getLogger(ApicurioCodegenWrapper.class); - private static final String DEFAULT_PACKAGE = "io.apicurio.api"; private final File outdir; private final JaxRsProjectSettings projectSettings;