Skip to content

Commit

Permalink
Merge branch 'main' into #30332
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand authored Jan 16, 2023
2 parents 3dfa00d + 8ee7a2e commit 9148362
Show file tree
Hide file tree
Showing 100 changed files with 355 additions and 265 deletions.
1 change: 1 addition & 0 deletions .github/workflows/vale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3
- name: Vale Linter
continue-on-error: true
uses: errata-ai/vale-action@reviewdog
with:
fail_on_error: false
Expand Down
2 changes: 1 addition & 1 deletion .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.zip
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
12 changes: 6 additions & 6 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<properties>
<bouncycastle.version>1.70</bouncycastle.version>
<bouncycastle.fips.version>1.0.2.3</bouncycastle.fips.version>
<bouncycastle.tls.fips.version>1.0.14</bouncycastle.tls.fips.version>
<bouncycastle.tls.fips.version>1.0.14.1</bouncycastle.tls.fips.version>
<findbugs.version>3.0.2</findbugs.version>
<jandex.version>3.0.5</jandex.version>
<resteasy.version>4.7.7.Final</resteasy.version>
Expand Down Expand Up @@ -79,9 +79,9 @@
<jboss-jaxb-api_2.3_spec.version>2.0.0.Final</jboss-jaxb-api_2.3_spec.version>
<asm.version>9.4</asm.version>
<commons-io.version>2.11.0</commons-io.version>
<jboss-metadata-web.version>15.2.0.Final</jboss-metadata-web.version>
<jboss-metadata-web.version>15.4.0</jboss-metadata-web.version>
<maven-toolchain.version>3.0-alpha-2</maven-toolchain.version>
<plexus-utils.version>3.3.0</plexus-utils.version>
<plexus-utils.version>3.3.1</plexus-utils.version>
<plexus-component-annotations.version>2.1.0</plexus-component-annotations.version>
<graal-sdk.version>22.3.0</graal-sdk.version>
<graal-svm.version>${graal-sdk.version}</graal-svm.version>
Expand Down Expand Up @@ -134,7 +134,7 @@
<junit.jupiter.version>5.9.1</junit.jupiter.version>
<junit-pioneer.version>1.5.0</junit-pioneer.version>
<testng.version>6.14.2</testng.version>
<infinispan.version>14.0.4.Final</infinispan.version>
<infinispan.version>14.0.5.Final</infinispan.version>
<infinispan.protostream.version>4.5.1.Final</infinispan.protostream.version>
<caffeine.version>3.1.1</caffeine.version>
<netty.version>4.1.86.Final</netty.version>
Expand Down Expand Up @@ -164,7 +164,7 @@
<liquibase.version>4.18.0</liquibase.version>
<snakeyaml.version>1.33</snakeyaml.version>
<osgi.version>6.0.0</osgi.version>
<mongo-client.version>4.8.1</mongo-client.version>
<mongo-client.version>4.8.2</mongo-client.version>
<mongo-crypt.version>1.6.1</mongo-crypt.version>
<proton-j.version>0.34.0</proton-j.version>
<javaparser.version>3.24.2</javaparser.version>
Expand All @@ -191,7 +191,7 @@
<google-cloud-functions.version>1.0.4</google-cloud-functions.version>
<commons-compress.version>1.22</commons-compress.version>
<commons-text.version>1.10.0</commons-text.version>
<gson.version>2.10</gson.version>
<gson.version>2.10.1</gson.version>
<log4j2-jboss-logmanager.version>1.1.1.Final</log4j2-jboss-logmanager.version>
<log4j2-api.version>2.19.0</log4j2-api.version>
<log4j-jboss-logmanager.version>1.3.0.Final</log4j-jboss-logmanager.version>
Expand Down
4 changes: 2 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

<!-- version.* properties are defined in jboss-parent and are overridden/updated here: -->
<version.enforcer.plugin>3.0.0-M3</version.enforcer.plugin>
<version.surefire.plugin>3.0.0-M7</version.surefire.plugin>
<version.surefire.plugin>3.0.0-M8</version.surefire.plugin>
<version.exec.plugin>3.0.0</version.exec.plugin>
<failsafe-plugin.version>${version.surefire.plugin}</failsafe-plugin.version>

Expand Down Expand Up @@ -59,7 +59,7 @@
<supported-maven-versions>[3.6.2,)</supported-maven-versions>

<!-- These 2 properties are used by CreateProjectMojo to add the Maven Wrapper -->
<proposed-maven-version>3.8.6</proposed-maven-version>
<proposed-maven-version>3.8.7</proposed-maven-version>
<maven-wrapper.version>3.1.1</maven-wrapper.version>
<gradle-wrapper.version>7.5.1</gradle-wrapper.version>
<quarkus-gradle-plugin.version>${project.version}</quarkus-gradle-plugin.version>
Expand Down
4 changes: 4 additions & 0 deletions core/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-my-first-extension.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Your extension is a multi-module project. So let's start by checking out the par
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<quarkus.version>{quarkus-version}</quarkus.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/building-native-image.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
NOTE: This multi-stage Docker build copies the Maven wrapper from the host machine.
The Maven wrapper (or the Gradle wrapper) is a convenient way to provide a specific version of Maven/Gradle.
It avoids having to create a base image with Maven and Gradle.
To provision the Maven Wrapper in your project, use: `mvn -N org.apache.maven.plugins:maven-wrapper-plugin:3.1.0:wrapper`.
To provision the Maven Wrapper in your project, use: `mvn -N org.apache.maven.plugins:maven-wrapper-plugin:3.1.1:wrapper`.

Save this file in `src/main/docker/Dockerfile.multistage` as it is not included in the getting started quickstart.

Expand Down
38 changes: 35 additions & 3 deletions docs/src/main/asciidoc/config-reference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,42 @@ the value `youshallnotpass` to the attribute `quarkus.datasource.password`.
* For a runner jar: `export QUARKUS_DATASOURCE_PASSWORD=youshallnotpass ; java -jar target/quarkus-app/quarkus-run.jar`
* For a native executable: `export QUARKUS_DATASOURCE_PASSWORD=youshallnotpass ; ./target/myapp-runner`

NOTE: Environment variables names follow the conversion rules specified by
[NOTE]
====
Environment variables names follow the conversion rules specified by
link:https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/configsources.asciidoc#default-configsources[MicroProfile Config].
NOTE: SmallRye Config specifies link:https://smallrye.io/smallrye-config/latest/config/environment-variables/[additional conversion rules].
Config searches three environment variables for a given property name (e.g. `foo.BAR.baz`):
- `foo.BAR.baz` - Exact match
- `foo_BAR_baz` - Replace each character that is neither alphanumeric nor `\_` with `_`
- `FOO_BAR_BAZ` - Replace each character that is neither alphanumeric nor `\_` with `_`;
then convert the name to upper case
====

[NOTE]
====
SmallRye Config specifies link:https://smallrye.io/smallrye-config/Main/config/environment-variables/[additional conversion rules].
- A property with double quotes `foo."bar".baz`, replace each character that is neither alphanumeric
nor `\_` with `_`: `FOO\__BAR__BAZ`
- A property with dashes `foo.bar-baz`, replace each character that is neither alphanumeric
nor `\_` with `_`: `FOO_BAR_BAZ`
- An indexed property `foo.bar[0]` or `foo.bar[0].baz`, replace each character that is neither alphanumeric
nor `\_` with `_`: `FOO_BAR_0_` or `FOO_BAR_0__BAZ`
In some situations, looking up the exact property name is impossible. For instance, when looking
up a configuration that is part of a `Map`, and the property name contains a dynamic segment (the `Map` key). In this
case, Quarkus relies upon each source’s list of property names. These must be converted back to their most likely
dotted format for Environment Variables.
By default, the underscore `_` of an Environment Variable name always maps to a dot `.`. If the property name contains
a dash or some other special character, that property name can be specified in another Config Source, with the expected
dotted format. It will provide additional information to perform a two-way conversion and match the property names.
To correctly lookup `Map` properties where `FOO_BAR_BAZ` is the property name and `BAR_BAZ` is the key, add
`foo.bar-baz` in a source with an ordinal lower than the EnvConfigSource (`300`).
====

[[env-file]]
=== `.env` file in the current working directory
Expand Down Expand Up @@ -555,7 +587,7 @@ Quarkus relies on link:https://github.com/smallrye/smallrye-config/[SmallRye Con
* Hide secrets

For more information, please check the
link:https://smallrye.io/smallrye-config/latest[SmallRye Config documentation].
link:https://smallrye.io/smallrye-config/Main[SmallRye Config documentation].

== Configuration Reference

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/asciidoc/config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public String hello() {
----

TIP: Use `@io.smallrye.config.ConfigMapping` annotation to group multiple configurations in a single interface. Please,
check the https://smallrye.io/smallrye-config/latest/config/mappings/[Config Mappings] documentation.
check the https://smallrye.io/smallrye-config/Main/config/mappings/[Config Mappings] documentation.

== Update the test

Expand Down Expand Up @@ -240,4 +240,4 @@ Quarkus relies on link:https://github.com/smallrye/smallrye-config/[SmallRye Con
* Hide secrets

For more information, please check the
link:https://smallrye.io/smallrye-config/latest/[SmallRye Config documentation].
link:https://smallrye.io/smallrye-config/Main/[SmallRye Config documentation].
2 changes: 1 addition & 1 deletion docs/src/main/asciidoc/jreleaser.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ As a reference, these are the full contents of the `pom.xml`:
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>{quarkus-version}</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
18 changes: 18 additions & 0 deletions docs/src/main/asciidoc/spring-data-rest.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,24 @@ It is important to annotate the correct method in order to customize its REST en
|`void deleteById(ID id)`
|===

==== Securing endpoints

This extension will automatically use the Security annotations within the package `javax.annotation.security` that are defined on your resource interfaces:

[source,java]
----
import javax.annotation.security.DenyAll;
import javax.annotation.security.RolesAllowed;
@DenyAll
public interface FruitResource extends CrudRepository<Fruit, Long> {
@RolesAllowed("superuser")
Iterable<Fruit> findAll();
}
----

Note that this feature is provided by the REST Data with Panache extension that this extension is using under the hood. So, pure Spring Boot applications might not behave the same way.

=== What is currently unsupported

* Only the repository methods listed above are supported. No other standard or custom methods are supported.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<resources-plugin.version>3.1.0</resources-plugin.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>

<azure.functions.maven.plugin.version>1.9.1</azure.functions.maven.plugin.version>
<functionAppName>${appName}</functionAppName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>999-SNAPSHOT</quarkus.platform.version>
<surefire-plugin.version>3.0.0-M7</surefire-plugin.version>
<surefire-plugin.version>3.0.0-M8</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,15 @@ void testAggregation() {
"num_visits"))
.sortBy(new AggregateArgs.SortBy().ascending("@day").descending("@country"))
.withCursor().cursorCount(2));
assertThat(result.count()).isEqualTo(2);
assertThat(result.count()).isBetween(1, 2);
assertThat(result.documents()).allSatisfy(d -> {
assertThat(d.property("day").asInteger()).isPositive();
assertThat(d.property("country").asString()).isNotNull();
assertThat(d.property("num_visits").asInteger()).isPositive();
});
assertThat(result.cursor()).isPositive();
result = search.ftCursorRead("myIndex", result.cursor());
assertThat(result.count()).isEqualTo(1);
assertThat(result.count()).isBetween(1, 2);
assertThat(result.documents()).allSatisfy(d -> {
assertThat(d.property("day").asInteger()).isPositive();
assertThat(d.property("country").asString()).isNotNull();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
Expand All @@ -93,6 +94,7 @@
import io.quarkus.smallrye.openapi.runtime.OpenApiDocumentService;
import io.quarkus.smallrye.openapi.runtime.OpenApiRecorder;
import io.quarkus.smallrye.openapi.runtime.OpenApiRuntimeConfig;
import io.quarkus.smallrye.openapi.runtime.RuntimeOnlyBuilder;
import io.quarkus.smallrye.openapi.runtime.filter.AutoBasicSecurityFilter;
import io.quarkus.smallrye.openapi.runtime.filter.AutoBearerTokenSecurityFilter;
import io.quarkus.smallrye.openapi.runtime.filter.AutoUrl;
Expand Down Expand Up @@ -173,11 +175,15 @@ void contributeClassesToIndex(BuildProducer<AdditionalIndexedClassesBuildItem> a

@BuildStep
void registerNativeImageResources(BuildProducer<ServiceProviderBuildItem> serviceProvider) {
// To map from smallrye and mp config to quarkus
serviceProvider.produce(ServiceProviderBuildItem.allProvidersFromClassPath(OpenApiConfigMapping.class.getName()));
serviceProvider.produce(ServiceProviderBuildItem.allProvidersFromClassPath(OASFactoryResolver.class.getName()));
}

@BuildStep
void runtimeOnly(BuildProducer<RunTimeConfigBuilderBuildItem> runTimeConfigBuilder) {
// To map from smallrye and mp config to quarkus
runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(RuntimeOnlyBuilder.class.getName()));
}

@BuildStep
void configFiles(BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFiles,
SmallRyeOpenApiConfig openApiConfig,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
io.quarkus.smallrye.openapi.deployment.OpenApiConfigMapping
io.quarkus.smallrye.openapi.runtime.OpenApiConfigMapping
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.quarkus.smallrye.openapi.deployment;
package io.quarkus.smallrye.openapi.runtime;

import java.util.Collections;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import java.nio.charset.StandardCharsets;

import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Observes;

import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.openapi.OASFilter;
import org.eclipse.microprofile.openapi.models.OpenAPI;

import io.quarkus.runtime.ShutdownEvent;
import io.smallrye.openapi.api.OpenApiConfig;
import io.smallrye.openapi.api.OpenApiConfigImpl;
import io.smallrye.openapi.api.OpenApiDocument;
Expand All @@ -24,13 +26,16 @@
@ApplicationScoped
public class OpenApiDocumentService implements OpenApiDocumentHolder {

private static final String OPENAPI_SERVERS = "mp.openapi.servers";
private final OpenApiDocumentHolder documentHolder;
private final String previousOpenApiServersSystemPropertyValue;

public OpenApiDocumentService(OASFilter autoSecurityFilter, Config config) {

String servers = config.getOptionalValue("quarkus.smallrye-openapi.servers", String.class).orElse(null);
this.previousOpenApiServersSystemPropertyValue = System.getProperty(OPENAPI_SERVERS);
if (servers != null && !servers.isEmpty()) {
System.setProperty("mp.openapi.servers", servers);
System.setProperty(OPENAPI_SERVERS, servers);
}

if (config.getOptionalValue("quarkus.smallrye-openapi.always-run-filter", Boolean.class).orElse(Boolean.FALSE)) {
Expand All @@ -40,6 +45,17 @@ public OpenApiDocumentService(OASFilter autoSecurityFilter, Config config) {
}
}

void reset(@Observes ShutdownEvent event) {
// Reset the value of the System property "mp.openapi.servers" to prevent side effects on tests since
// the value of System property "mp.openapi.servers" takes precedence over the value of
// "quarkus.smallrye-openapi.servers" due to the configuration mapping
if (previousOpenApiServersSystemPropertyValue == null) {
System.clearProperty(OPENAPI_SERVERS);
} else {
System.setProperty(OPENAPI_SERVERS, previousOpenApiServersSystemPropertyValue);
}
}

public byte[] getJsonDocument() {
return this.documentHolder.getJsonDocument();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package io.quarkus.smallrye.openapi.runtime;

import io.quarkus.runtime.configuration.ConfigBuilder;
import io.smallrye.config.SmallRyeConfigBuilder;

public final class RuntimeOnlyBuilder implements ConfigBuilder {
@Override
public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) {
return builder.withInterceptors(new OpenApiConfigMapping());
}
}
Loading

0 comments on commit 9148362

Please sign in to comment.