Skip to content

Commit 817f1b3

Browse files
committed
Merge remote-tracking branch 'upstream/master' into SentryMan-patch-1
2 parents 2a331c0 + b4a3ccf commit 817f1b3

File tree

121 files changed

+5067
-320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+5067
-320
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ indent_style = space
1010
insert_final_newline = true
1111
trim_trailing_whitespace = true
1212
spaces_around_operators = true
13+
max_line_length = 135

.github/workflows/build.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,41 @@
11
name: Build
22

33
on: [push, pull_request, workflow_dispatch]
4-
54
jobs:
65
build:
7-
86
runs-on: ${{ matrix.os }}
97
permissions:
108
contents: read
119
packages: write
1210
strategy:
1311
fail-fast: false
1412
matrix:
15-
java_version: [11,17]
13+
java_version: [11, 17, 19]
1614
os: [ubuntu-latest]
1715

1816
steps:
19-
- uses: actions/checkout@v2
20-
- name: Set up Java
21-
uses: actions/setup-java@v2
22-
with:
23-
java-version: ${{ matrix.java_version }}
24-
distribution: 'zulu'
25-
- name: Maven cache
26-
uses: actions/cache@v2
27-
env:
28-
cache-name: maven-cache
29-
with:
30-
path:
31-
~/.m2
32-
key: build-${{ env.cache-name }}
33-
- name: Maven version
34-
run: mvn --version
35-
- name: Build with Maven
36-
run: mvn clean test
17+
- uses: actions/checkout@v2
18+
- name: Set up Java
19+
uses: actions/setup-java@v2
20+
with:
21+
java-version: ${{ matrix.java_version }}
22+
distribution: "zulu"
23+
- name: Maven cache
24+
uses: actions/cache@v2
25+
env:
26+
cache-name: maven-cache
27+
with:
28+
path: ~/.m2
29+
key: build-${{ env.cache-name }}
30+
- name: Maven version
31+
run: mvn --version
32+
- name: Build with Maven
33+
env:
34+
JAVA_VERSION: ${{ matrix.java_version }}
35+
run: |
36+
if (( JAVA_VERSION < 19 ));
37+
then
38+
mvn clean test -pl "!:avaje-http-nima-generator"
39+
else
40+
mvn clean test
41+
fi

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,11 @@ build/
33
.idea/
44
*.iml
55
.gradle
6+
*.prefs
7+
*.class*
8+
*.factorypath
9+
*.project
10+
*.processors
11+
*/bin/
12+
*.editorconfig
13+
*.Module

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public class WidgetController {
7878
public WidgetController(HelloComponent hello) {
7979
this.hello = hello;
8080
}
81-
81+
8282
@Get("/{id}")
8383
Widget getById(int id) {
8484
return new Widget(id, "you got it"+ hello.hello());
@@ -104,7 +104,7 @@ The annotation processor will generate controller classes implementing the WebRo
104104
get all the WebRoutes and register them with Javalin using:
105105

106106
```java
107-
var routes = BeanScope.builder().build().list(WebRoutes.class);
107+
var routes = BeanScope.builder().build().list(WebRoutes.class);
108108

109109
Javalin.create()
110110
.routes(() -> routes.forEach(WebRoutes::registerRoutes))
@@ -117,7 +117,7 @@ The annotation processor will generate controller classes implementing the Helid
117117
get all the Services and register them with Helidon `RoutingBuilder`.
118118

119119
```java
120-
var routes = BeanScope.builder().build().list(Service.class);
120+
var routes = BeanScope.builder().build().list(Service.class);
121121
var routingBuilder = Routing.builder().register(routes.stream().toArray(Service[]::new));
122122
WebServer.builder()
123123
.addMediaSupport(JacksonSupport.create())
@@ -132,7 +132,7 @@ The annotation processor will generate controller classes implementing the Helid
132132
get all the services and register them with the Helidon `HttpRouting`.
133133

134134
```java
135-
var routes = BeanScope.builder().build().list(HttpService.class);
135+
var routes = BeanScope.builder().build().list(HttpService.class);
136136
final var builder = HttpRouting.builder();
137137

138138
for (final HttpService httpService : routes) {

http-api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<parent>
55
<groupId>io.avaje</groupId>
66
<artifactId>avaje-http-generator-parent</artifactId>
7-
<version>1.18-SNAPSHOT</version>
7+
<version>1.21-SNAPSHOT</version>
88
<relativePath>..</relativePath>
99
</parent>
1010

1111
<artifactId>avaje-http-api</artifactId>
1212

1313
<scm>
1414
<developerConnection>scm:git:[email protected]:avaje/avaje-http.git</developerConnection>
15-
<tag>HEAD</tag>
15+
<tag>avaje-http-generator-parent-1.19</tag>
1616
</scm>
1717

1818
<dependencies>

http-api/src/main/java/io/avaje/http/api/MediaType.java

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public interface MediaType {
3535
*/
3636
String APPLICATION_FORM_URLENCODED = "application/x-www-form-urlencoded";
3737

38-
3938
/**
4039
* A {@code String} constant representing {@value #MULTIPART_FORM_DATA} media type.
4140
*/
@@ -51,7 +50,6 @@ public interface MediaType {
5150
*/
5251
String TEXT_PLAIN = "text/plain";
5352

54-
5553
/**
5654
* A {@code String} constant representing {@value #TEXT_XML} media type.
5755
*/
@@ -71,5 +69,35 @@ public interface MediaType {
7169
* {@link String} representation of {@value #APPLICATION_JSON_PATCH_JSON} media type..
7270
*/
7371
String APPLICATION_JSON_PATCH_JSON = "application/json-patch+json";
74-
72+
73+
/**
74+
* {@link String} representation of {@value #APPLICATION_PDF} media type.
75+
*/
76+
String APPLICATION_PDF = "application/pdf";
77+
78+
/**
79+
* {@link String} representation of {@value #IMAGE_GIF} media type.
80+
*/
81+
String IMAGE_GIF = "image/gif";
82+
83+
/**
84+
* {@link String} representation of {@value #IMAGE_JPEG} media type.
85+
*/
86+
String IMAGE_JPEG = "image/jpeg";
87+
88+
/**
89+
* {@link String} representation of {@value #IMAGE_PNG} media type.
90+
*/
91+
String IMAGE_PNG = "image/png";
92+
93+
/**
94+
* {@link String} representation of {@value #MULTIPART_MIXED} media type.
95+
*/
96+
String MULTIPART_MIXED = "multipart/mixed";
97+
98+
/**
99+
* {@link String} representation of {@value #MULTIPART_RELATED} media type.
100+
*/
101+
String MULTIPART_RELATED = "multipart/related";
102+
75103
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package io.avaje.http.api;
2+
3+
import static java.lang.annotation.ElementType.METHOD;
4+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
5+
6+
import java.lang.annotation.Repeatable;
7+
import java.lang.annotation.Retention;
8+
import java.lang.annotation.Target;
9+
10+
/**
11+
* Specify endpoint response status code/description/type.
12+
*
13+
* <p>When not specified the default 2xx openAPI generation is based on the javadoc of the method.
14+
* <p> Will not override the default 2xx generated openapi unless status code is 2xx
15+
* <pre>{@code
16+
* @Post("/post")
17+
* @OpenAPIReturns(responseCode = "200", description = "from annotaion")
18+
* @OpenAPIReturns(responseCode = "201")
19+
* @OpenAPIReturns(responseCode = "500", description = "Some other Error", type=ErrorResponse.class)
20+
* ResponseModel endpoint() {}
21+
*
22+
* }</pre>
23+
*/
24+
@Target(value = METHOD)
25+
@Retention(value = RUNTIME)
26+
@Repeatable(OpenAPIResponses.class)
27+
public @interface OpenAPIResponse {
28+
29+
/** the http status code of this response */
30+
String responseCode();
31+
32+
/**
33+
* The description of the return value. By default uses the @return javadoc of the method as the
34+
* description
35+
*/
36+
String description() default "";
37+
38+
/**
39+
* The concrete type that that this endpoint returns. If status code is a 2xx code it will default
40+
* to the return type of the method
41+
*/
42+
Class<?> type() default Void.class;
43+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package io.avaje.http.api;
2+
3+
import static java.lang.annotation.ElementType.METHOD;
4+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
5+
6+
import java.lang.annotation.Retention;
7+
import java.lang.annotation.Target;
8+
9+
/**
10+
* Container for repeatable {@link OpenAPIResponse} annotation
11+
*
12+
* @see OpenAPIResponse
13+
*/
14+
@Target(value = METHOD)
15+
@Retention(value = RUNTIME)
16+
public @interface OpenAPIResponses {
17+
OpenAPIResponse[] value();
18+
}

http-generator-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.avaje</groupId>
77
<artifactId>avaje-http-generator-parent</artifactId>
8-
<version>1.18-SNAPSHOT</version>
8+
<version>1.21-SNAPSHOT</version>
99
<relativePath>..</relativePath>
1010
</parent>
1111

0 commit comments

Comments
 (0)