Skip to content

Commit a7c32a8

Browse files
committed
doc: migration to 4.x
- Add missing note on default annotation `value` attribute on `XXXParam`
1 parent 41a8254 commit a7c32a8

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

docs/asciidoc/migration/4.x.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,23 @@ This is a **work in progress** document, if something is wrong or missing please
1010

1111
- Java 21 as minimum
1212

13+
==== Special HTTP names
14+
15+
Starting from 4.0.7 `@XXXParam` the default annotation `value` attribute is actually that: *the default value*
16+
of the parameter. In previous version this was used it for `invalid/special HTTP names`.
17+
18+
In 3.x:
19+
20+
@QuerParam("some-http-name") String name
21+
22+
In 4.x
23+
24+
@QuerParam(name = "some-http-name") String name
25+
26+
The `value` is now reserved for default values:
27+
28+
@QueryParam("20") int pageSize
29+
1330
==== Buffer API
1431

1532
The package `io.jooby.buffer` is gone. It was replaced by `io.jooby.output` these classes
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
6+
package tests.i3836;
7+
8+
import io.jooby.annotation.GET;
9+
import io.jooby.annotation.Path;
10+
import io.jooby.annotation.QueryParam;
11+
import tests.i3804.Base3804;
12+
13+
@Path("/3836")
14+
public class C3836 extends Base3804 {
15+
@GET("/attribute")
16+
public String oddNameWithNameAttribute(@QueryParam(name = "some-http") String value) {
17+
return value;
18+
}
19+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Jooby https://jooby.io
3+
* Apache License Version 2.0 https://jooby.io/LICENSE.txt
4+
* Copyright 2014 Edgar Espina
5+
*/
6+
package tests.i3836;
7+
8+
import org.junit.jupiter.api.Assertions;
9+
import org.junit.jupiter.api.Test;
10+
11+
import io.jooby.apt.ProcessorRunner;
12+
13+
public class Issue3836 {
14+
@Test
15+
public void shouldSupportNameAttribute() throws Exception {
16+
new ProcessorRunner(new C3836())
17+
.withSourceCode(
18+
source -> {
19+
System.out.println(source);
20+
Assertions.assertTrue(
21+
source.contains(
22+
"return"
23+
+ " c.oddNameWithNameAttribute(ctx.query(\"some-http\").valueOrNull());"));
24+
Assertions.assertTrue(
25+
source.contains(
26+
"return"
27+
+ " c.oddNameWithNameAttribute(ctx.query(\"some-http-named\").valueOrNull());"));
28+
});
29+
}
30+
}

0 commit comments

Comments
 (0)