Skip to content

Commit 83dd9ad

Browse files
authored
Nima JsonB Stream (#191)
* nima stream * Revert "nima stream" This reverts commit d3f8b08. * use the new jsonb json output
1 parent e43a596 commit 83dd9ad

File tree

3 files changed

+5
-14
lines changed

3 files changed

+5
-14
lines changed

http-generator-nima/src/main/java/io/avaje/http/generator/helidon/nima/ControllerMethodWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ void writeHandler(boolean requestScoped) {
4242
final var bodyType = method.bodyType();
4343
if (bodyType != null) {
4444

45-
if (bodyType.equals("InputStream")) {
45+
if ("InputStream".equals(bodyType)) {
4646
writer.append(" var %s = req.content().inputStream();", method.bodyName()).eol();
4747
} else if (useJsonB) {
4848
final var fieldName =
@@ -118,7 +118,7 @@ void writeHandler(boolean requestScoped) {
118118
writeContextReturn();
119119
if (producesJson()) {
120120
final var uType = UType.parse(method.returnType());
121-
writer.append(" %sJsonType.toJson(result, res.outputStream());", uType.shortName()).eol();
121+
writer.append(" %sJsonType.toJson(result, JsonOutput.of(res));", uType.shortName()).eol();
122122
} else {
123123
writer.append(" res.send(result);").eol();
124124
}

http-generator-nima/src/main/java/io/avaje/http/generator/helidon/nima/ControllerWriter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ControllerWriter extends BaseControllerWriter {
2323
reader.addImportType("io.avaje.jsonb.Jsonb");
2424
reader.addImportType("io.avaje.jsonb.JsonType");
2525
reader.addImportType("io.avaje.jsonb.Types");
26+
reader.addImportType("io.avaje.jsonb.stream.JsonOutput");
2627
this.jsonTypes = JsonBUtil.jsonTypes(reader);
2728
jsonTypes.values().stream()
2829
.map(UType::importTypes)

tests/test-nima-jsonb/pom.xml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,19 @@
3636
<dependency>
3737
<groupId>io.helidon.nima.webserver</groupId>
3838
<artifactId>helidon-nima-webserver</artifactId>
39-
<version>4.0.0-ALPHA4</version>
39+
<version>4.0.0-ALPHA5</version>
4040
</dependency>
4141
<dependency>
4242
<groupId>io.helidon.nima.http.media</groupId>
4343
<artifactId>helidon-nima-http-media-jsonb</artifactId>
44-
<version>4.0.0-ALPHA4</version>
44+
<version>4.0.0-ALPHA5</version>
4545
</dependency>
4646
<dependency>
4747
<groupId>io.avaje</groupId>
4848
<artifactId>avaje-http-nima-generator</artifactId>
4949
<version>${project.version}</version>
5050
<scope>test</scope>
5151
</dependency>
52-
<!-- <dependency>-->
53-
<!-- <groupId>io.helidon.nima.http2</groupId>-->
54-
<!-- <artifactId>helidon-nima-http2-webserver</artifactId>-->
55-
<!-- <version>4.0.0-SNAPSHOT</version>-->
56-
<!-- </dependency>-->
57-
<!-- <dependency>-->
58-
<!-- <groupId>io.helidon.nima.websocket</groupId>-->
59-
<!-- <artifactId>helidon-nima-websocket-webserver</artifactId>-->
60-
<!-- <version>4.0.0-SNAPSHOT</version>-->
61-
<!-- </dependency>-->
6252
<dependency>
6353
<groupId>io.avaje</groupId>
6454
<artifactId>junit</artifactId>

0 commit comments

Comments
 (0)