Skip to content

Commit e03f74a

Browse files
committed
adjusted generated code to google-java-format
1 parent 54a762b commit e03f74a

File tree

14 files changed

+69
-30
lines changed

14 files changed

+69
-30
lines changed

src/main/groovy/com/github/hauner/openapi/spring/writer/StringEnumWriter.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class StringEnumWriter {
4141
target.write ("\n")
4242
}
4343

44-
target.write ("public enum ${dataType.type} {\n\n")
44+
target.write ("public enum ${dataType.type} {\n")
4545

4646
def values = []
4747
dataType.values.each {
@@ -68,7 +68,7 @@ class StringEnumWriter {
6868
target.write("""\
6969
@JsonCreator
7070
public static ${dataType.type} fromValue(String value) {
71-
for (${dataType.type} val: ${dataType.type}.values()) {
71+
for (${dataType.type} val : ${dataType.type}.values()) {
7272
if (val.value.equals(value)) {
7373
return val;
7474
}

src/test/groovy/com/github/hauner/openapi/spring/writer/StringEnumWriterSpec.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public enum Foo {
7575
then:
7676
target.toString ().contains ("""\
7777
public enum Foo {
78-
7978
FOO("foo"),
8079
FOO_2("_foo-2"),
8180
FOO_FOO("foo-foo");
@@ -144,7 +143,7 @@ public enum Foo {
144143
145144
@JsonCreator
146145
public static Foo fromValue(String value) {
147-
for (Foo val: Foo.values()) {
146+
for (Foo val : Foo.values()) {
148147
if (val.value.equals(value)) {
149148
return val;
150149
}

src/testInt/resources/params-enum/generated/api/EnumApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
public interface EnumApi {
1515

1616
@GetMapping(path = "/endpoint")
17-
ResponseEntity<Void> getEndpoint(@RequestParam(name = "foo") Foo foo, @RequestParam(name = "bar") Bar bar);
17+
ResponseEntity<Void> getEndpoint(
18+
@RequestParam(name = "foo") Foo foo, @RequestParam(name = "bar") Bar bar);
1819

1920
}

src/testInt/resources/params-enum/generated/model/Bar.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.fasterxml.jackson.annotation.JsonValue;
1010

1111
public enum Bar {
12-
1312
BAR("bar"),
1413
BAR_2("bar-2"),
1514
BAR_BAR("bar-bar");
@@ -27,7 +26,7 @@ public String getValue() {
2726

2827
@JsonCreator
2928
public static Bar fromValue(String value) {
30-
for (Bar val: Bar.values()) {
29+
for (Bar val : Bar.values()) {
3130
if (val.value.equals(value)) {
3231
return val;
3332
}

src/testInt/resources/params-enum/generated/model/Foo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.fasterxml.jackson.annotation.JsonValue;
1010

1111
public enum Foo {
12-
1312
FOO("foo"),
1413
FOO_2("foo-2"),
1514
FOO_FOO("foo-foo");
@@ -27,7 +26,7 @@ public String getValue() {
2726

2827
@JsonCreator
2928
public static Foo fromValue(String value) {
30-
for (Foo val: Foo.values()) {
29+
for (Foo val : Foo.values()) {
3130
if (val.value.equals(value)) {
3231
return val;
3332
}

src/testInt/resources/params-path-simple-data-types/generated/api/EndpointApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public interface EndpointApi {
1515
ResponseEntity<Void> getEndpointFoo(@PathVariable(name = "foo") String foo);
1616

1717
@GetMapping(path = "/endpoint-optional/{foo}")
18-
ResponseEntity<Void> getEndpointOptionalFoo(@PathVariable(name = "foo", required = false) String foo);
18+
ResponseEntity<Void> getEndpointOptionalFoo(
19+
@PathVariable(name = "foo", required = false) String foo);
1920

2021
}

src/testInt/resources/params-request-body-multipart-form-data/generated/api/Api.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@
1313
public interface Api {
1414

1515
@PostMapping(path = "/multipart/single-file")
16-
ResponseEntity<Void> postMultipartSingleFile(@RequestParam(name = "file") MultipartFile file, @RequestParam(name = "other") String other);
16+
ResponseEntity<Void> postMultipartSingleFile(
17+
@RequestParam(name = "file") MultipartFile file,
18+
@RequestParam(name = "other") String other);
1719

1820
@PostMapping(path = "/multipart/multiple-files")
19-
ResponseEntity<Void> postMultipartMultipleFiles(@RequestParam(name = "files") MultipartFile[] files, @RequestParam(name = "other") String other);
21+
ResponseEntity<Void> postMultipartMultipleFiles(
22+
@RequestParam(name = "files") MultipartFile[] files,
23+
@RequestParam(name = "other") String other);
2024

2125
}

src/testInt/resources/params-request-body/generated/api/Api.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
public interface Api {
1414

15-
@PostMapping(path = "/book", consumes = {"application/json"}, produces = {"application/json"})
15+
@PostMapping(
16+
path = "/book",
17+
consumes = {"application/json"},
18+
produces = {"application/json"})
1619
ResponseEntity<Book> postBook(@RequestBody Book body);
1720

1821
}

src/testInt/resources/params-simple-data-types/generated/api/EndpointApi.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public interface EndpointApi {
1515
ResponseEntity<Void> getEndpoint(@RequestParam(name = "foo") String foo);
1616

1717
@GetMapping(path = "/endpoint-optional")
18-
ResponseEntity<Void> getEndpointOptional(@RequestParam(name = "foo", required = false, defaultValue = "bar") String foo);
18+
ResponseEntity<Void> getEndpointOptional(
19+
@RequestParam(name = "foo", required = false, defaultValue = "bar") String foo);
1920

2021
}

src/testInt/resources/params-spring-pageable-mapping/generated/api/Api.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212

1313
public interface Api {
1414

15-
@GetMapping(path = "/page", produces = {"application/json"})
15+
@GetMapping(
16+
path = "/page",
17+
produces = {"application/json"})
1618
ResponseEntity<Page<String>> getPage(Pageable pageable);
1719

18-
@GetMapping(path = "/page-inline", produces = {"application/json"})
20+
@GetMapping(
21+
path = "/page-inline",
22+
produces = {"application/json"})
1923
ResponseEntity<Page<String>> getPageInline(Pageable pageable);
2024

2125
}

0 commit comments

Comments
 (0)