Skip to content

Commit

Permalink
Fix native regressions in Config validation
Browse files Browse the repository at this point in the history
Fixes: quarkusio#18814
(cherry picked from commit c85b802)
  • Loading branch information
geoand authored and gsmet committed Jul 21, 2021
1 parent 262e53d commit abb2e13
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ void validateConfigProperties(ConfigRecorder recorder, List<ConfigPropertyBuildI
actualTypeArgumentNames = new ArrayList<>(argumentTypes.size());
for (Type argumentType : argumentTypes) {
actualTypeArgumentNames.add(argumentType.name().toString());
if (argumentType.kind() != Kind.PRIMITIVE) {
reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, argumentType.name().toString()));
}
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ interface Form {

@JsonProperty
Optional<String> cookie();

@JsonProperty
@WithDefault("1")
List<Integer> positions();
}

interface Proxy {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.quarkus.it.smallrye.config;

import java.util.List;

import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.json.Json;
Expand Down Expand Up @@ -28,6 +30,9 @@ public class ServerResource {
@Inject
@ConfigProperty(name = "server.info.message")
Instance<String> message;
@Inject
@ConfigProperty(name = "http.server.form.positions")
List<Integer> positions;

@GET
public Response getServer() {
Expand Down Expand Up @@ -65,4 +70,10 @@ public Response validator() {
public String info() {
return message.get();
}

@GET
@Path("/positions")
public List<Integer> positions() {
return positions;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ http:
login-page: login.html
error-page: error.html
landing-page: index.html
positions:
- 10
- 20

ssl:
port: 8443
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void mapping() {
.body("form.form.loginPage", equalTo("login.html"))
.body("form.form.errorPage", equalTo("error.html"))
.body("form.form.landingPage", equalTo("index.html"))
.body("form.form.positions.size()", equalTo(2))
.body("ssl.port", equalTo(8443))
.body("ssl.certificate", equalTo("certificate"))
.body("cors.methods[0]", equalTo("GET"))
Expand All @@ -68,6 +69,15 @@ void properties() {
.body("port", equalTo(8080));
}

@Test
void positions() {
given()
.get("/server/positions")
.then()
.statusCode(OK.getStatusCode())
.body(equalTo("[10,20]"));
}

@Test
void info() {
given()
Expand Down

0 comments on commit abb2e13

Please sign in to comment.