Skip to content

Commit 040f319

Browse files
authored
Fix Bean Param Enum Imports (#187)
* fix collection imports * move multi test * Update pom.xml * fix bean param enum import * Update HelloControllerTest.java * Update GetBeanForm.java * Update pom.xml
1 parent a8a2ad7 commit 040f319

File tree

4 files changed

+18
-33
lines changed

4 files changed

+18
-33
lines changed

http-client/pom.xml

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,12 @@
4343
<dependency>
4444
<groupId>io.avaje</groupId>
4545
<artifactId>avaje-inject</artifactId>
46-
<version>8.13</version>
46+
<version>9.0-RC3</version>
4747
<optional>true</optional>
4848
</dependency>
4949

5050
<!-- test dependencies -->
5151

52-
<!-- <dependency>-->
53-
<!-- <groupId>io.avaje</groupId>-->
54-
<!-- <artifactId>avaje-slf4j-jpl</artifactId>-->
55-
<!-- <version>1.1</version>-->
56-
<!-- <scope>test</scope>-->
57-
<!-- </dependency>-->
58-
5952
<dependency>
6053
<groupId>io.avaje</groupId>
6154
<artifactId>avaje-applog-slf4j</artifactId>
@@ -97,15 +90,6 @@
9790
<version>1.1</version>
9891
<scope>test</scope>
9992
</dependency>
100-
101-
<!-- test annotation processors -->
102-
<!-- <dependency>-->
103-
<!-- <groupId>io.avaje</groupId>-->
104-
<!-- <artifactId>avaje-inject-generator</artifactId>-->
105-
<!-- <version>8.6</version>-->
106-
<!-- <scope>test</scope>-->
107-
<!-- </dependency>-->
108-
10993
</dependencies>
11094

11195
<build>
@@ -134,19 +118,6 @@
134118
<plugin>
135119
<artifactId>maven-surefire-plugin</artifactId>
136120
<version>3.0.0-M6</version>
137-
<!-- <configuration>-->
138-
<!-- <argLine>-->
139-
<!-- &#45;&#45;add-modules com.fasterxml.jackson.databind-->
140-
<!-- &#45;&#45;add-modules io.avaje.jsonb-->
141-
<!-- &#45;&#45;add-opens io.avaje.http.client/io.avaje.http.client=ALL-UNNAMED-->
142-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.webserver=ALL-UNNAMED-->
143-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.github=ALL-UNNAMED-->
144-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.webserver=com.fasterxml.jackson.databind-->
145-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.github=com.fasterxml.jackson.databind-->
146-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.github=io.avaje.jsonb-->
147-
<!-- &#45;&#45;add-opens io.avaje.http.client/org.example.github=io.avaje.inject-->
148-
<!-- </argLine>-->
149-
<!-- </configuration>-->
150121
</plugin>
151122

152123
</plugins>

http-generator-core/src/main/java/io/avaje/http/generator/core/ElementReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ TypeHandler initTypeHandler() {
102102
!isCollection && typeOp.filter(t -> t.mainType().startsWith("java.util.Map")).isPresent();
103103

104104
if (mainTypeEnum) {
105-
return TypeMap.enumParamHandler(type);
105+
return TypeMap.enumParamHandler(typeOp.orElseThrow());
106106
} else if (isCollection) {
107107
this.isParamCollection = true;
108108
final var isEnumCollection =

tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/GetBeanForm.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package org.example.myapp.web;
22

33
import java.util.List;
4+
import java.util.Set;
45

56
import javax.validation.Valid;
67
import javax.validation.constraints.Email;
78
import javax.validation.constraints.NotNull;
89
import javax.validation.constraints.Size;
910

1011
import io.avaje.http.api.Header;
12+
import io.avaje.http.api.QueryParam;
1113
import io.avaje.jsonb.Json;
1214

1315
@Json
@@ -23,8 +25,10 @@ public class GetBeanForm {
2325
private String email;
2426

2527
private List<String> addresses;
26-
@Header
27-
private String head;
28+
29+
@Header private String head;
30+
31+
@QueryParam private Set<ServerType> type;
2832

2933
public String getName() {
3034
return name;
@@ -67,4 +71,12 @@ public String getHead() {
6771
public void setHead(String head) {
6872
this.head = head;
6973
}
74+
75+
public Set<ServerType> getType() {
76+
return type;
77+
}
78+
79+
public void setType(Set<ServerType> type) {
80+
this.type = type;
81+
}
7082
}

tests/test-javalin-jsonb/src/test/java/org/example/myapp/HelloControllerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ void get_validate_bean_expect422() {
241241
final HttpResponse<String> hres = client.request()
242242
.path("hello/withValidBean")
243243
.queryParam("email", "[email protected]")
244+
.queryParam("type", "PROXY")
244245
.GET()
245246
.asString();
246247

@@ -253,6 +254,7 @@ void get_validate_bean_expect200() {
253254
.path("hello/withValidBean")
254255
.queryParam("name", "hello")
255256
.queryParam("email", "[email protected]")
257+
.queryParam("type", "PROXY")
256258
.GET()
257259
.asString();
258260

0 commit comments

Comments
 (0)