Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/generatr/parameter-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ will generate the following interface method:

```java
@GetMapping(path = "/endpoint")
ResponseEntity<void> getEndpoint(@RequestParam(name = "foo", required = false, defaultValue = "not set") String foo);
ResponseEntity<Void> getEndpoint(@RequestParam(name = "foo", required = false, defaultValue = "not set") String foo);
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 the original authors
* Copyright 2019-2020 the original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,7 @@ class NoneDataType implements DataType {

@Override
String getName () {
'void'
'Void'
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getPing();
ResponseEntity<Void> getPing();
"""
}

Expand Down Expand Up @@ -162,7 +162,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestParam(name = "foo") String foo);
ResponseEntity<Void> getFoo(@RequestParam(name = "foo") String foo);
"""
}

Expand All @@ -179,7 +179,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestParam(name = "foo", required = false) String foo);
ResponseEntity<Void> getFoo(@RequestParam(name = "foo", required = false) String foo);
"""
}

Expand All @@ -196,7 +196,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestHeader(name = "x-foo") String xFoo);
ResponseEntity<Void> getFoo(@RequestHeader(name = "x-foo") String xFoo);
"""
}

Expand All @@ -213,7 +213,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestHeader(name = "x-foo", required = false) String xFoo);
ResponseEntity<Void> getFoo(@RequestHeader(name = "x-foo", required = false) String xFoo);
"""
}

Expand All @@ -230,7 +230,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@CookieValue(name = "foo") String foo);
ResponseEntity<Void> getFoo(@CookieValue(name = "foo") String foo);
"""
}

Expand All @@ -247,7 +247,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@CookieValue(name = "foo", required = false) String foo);
ResponseEntity<Void> getFoo(@CookieValue(name = "foo", required = false) String foo);
"""
}

Expand All @@ -269,7 +269,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(Foo foo);
ResponseEntity<Void> getFoo(Foo foo);
"""
}

Expand All @@ -286,7 +286,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestParam(name = "foo") Map foo);
ResponseEntity<Void> getFoo(@RequestParam(name = "foo") Map foo);
"""
}

Expand All @@ -303,7 +303,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFOOooBARrr(@RequestParam(name = "foo") String foo);
ResponseEntity<Void> getFOOooBARrr(@RequestParam(name = "foo") String foo);
"""
}

Expand All @@ -320,7 +320,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestParam(name = "_fo-o") String foO);
ResponseEntity<Void> getFoo(@RequestParam(name = "_fo-o") String foO);
"""
}

Expand All @@ -341,7 +341,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@PostMapping(path = "${endpoint.path}", consumes = {"application/json"})
ResponseEntity<void> postFoo(@RequestBody FooRequestBody body);
ResponseEntity<Void> postFoo(@RequestBody FooRequestBody body);
"""
}

Expand All @@ -363,7 +363,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@PostMapping(path = "${endpoint.path}", consumes = {"application/json"})
ResponseEntity<void> postFoo(@RequestBody(required = false) FooRequestBody body);
ResponseEntity<Void> postFoo(@RequestBody(required = false) FooRequestBody body);
"""
}

Expand All @@ -382,7 +382,7 @@ class MethodWriterSpec extends Specification {
then:
target.toString () == """\
@GetMapping(path = "${endpoint.path}")
ResponseEntity<void> getFoo(@RequestParam(name = "foo", required = false, defaultValue = "bar") String foo);
ResponseEntity<Void> getFoo(@RequestParam(name = "foo", required = false, defaultValue = "bar") String foo);
"""
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
public interface EndpointApi {

@GetMapping(path = "/endpoint")
ResponseEntity<void> getEndpoint();
ResponseEntity<Void> getEndpoint();

@PutMapping(path = "/endpoint")
ResponseEntity<void> putEndpoint();
ResponseEntity<Void> putEndpoint();

@PostMapping(path = "/endpoint")
ResponseEntity<void> postEndpoint();
ResponseEntity<Void> postEndpoint();

@PatchMapping(path = "/endpoint")
ResponseEntity<void> patchEndpoint();
ResponseEntity<Void> patchEndpoint();

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public interface EndpointApi {

@GetMapping(path = "/endpoint-object")
ResponseEntity<void> getEndpointObject(@RequestParam Props props);
ResponseEntity<Void> getEndpointObject(@RequestParam Props props);

@GetMapping(path = "/endpoint-map")
ResponseEntity<void> getEndpointMap(@RequestParam(name = "props") Map props);
ResponseEntity<Void> getEndpointMap(@RequestParam(name = "props") Map props);

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
public interface EnumApi {

@GetMapping(path = "/endpoint")
ResponseEntity<void> getEndpoint(@RequestParam(name = "foo") Foo foo, @RequestParam(name = "bar") Bar bar);
ResponseEntity<Void> getEndpoint(@RequestParam(name = "foo") Foo foo, @RequestParam(name = "bar") Bar bar);

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public interface EndpointApi {

@GetMapping(path = "/endpoint/{foo}")
ResponseEntity<void> getEndpointFoo(@PathVariable(name = "foo") String foo);
ResponseEntity<Void> getEndpointFoo(@PathVariable(name = "foo") String foo);

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
public interface Api {

@PostMapping(path = "/multipart/single-file")
ResponseEntity<void> postMultipartSingleFile(@RequestParam(name = "file") MultipartFile file, @RequestParam(name = "other") String other);
ResponseEntity<Void> postMultipartSingleFile(@RequestParam(name = "file") MultipartFile file, @RequestParam(name = "other") String other);

@PostMapping(path = "/multipart/multiple-files")
ResponseEntity<void> postMultipartMultipleFiles(@RequestParam(name = "files") MultipartFile[] files, @RequestParam(name = "other") String other);
ResponseEntity<Void> postMultipartMultipleFiles(@RequestParam(name = "files") MultipartFile[] files, @RequestParam(name = "other") String other);

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
public interface EndpointApi {

@GetMapping(path = "/endpoint")
ResponseEntity<void> getEndpoint(@RequestParam(name = "foo") String foo);
ResponseEntity<Void> getEndpoint(@RequestParam(name = "foo") String foo);

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

}