Skip to content

Commit 0bfce1e

Browse files
committed
add integration test (#439)
1 parent 1c1ed86 commit 0bfce1e

10 files changed

Lines changed: 152 additions & 0 deletions

File tree

src/testInt/kotlin/io/openapiprocessor/spring/ProcessorTestSets.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import io.openapiprocessor.test.*
1010

1111
val ALL_3x: List<TestParams2> = join(
1212
emptyList(),
13+
tests("endpoint-exchange-annotations"),
1314
testX("endpoint-http-mapping"),
1415
tests("params-complex-data-types"),
1516
testX("params-enum"),
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
items:
2+
- inputs/mapping.yaml
3+
- inputs/openapi30.yaml
4+
- inputs/openapi31.yaml
5+
- inputs/openapi32.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
openapi-processor-spring: v1
2+
3+
options:
4+
package-name: generated
5+
format-code: false
6+
7+
spring:
8+
annotations: exchange
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.0.2
2+
info:
3+
title: test request/response with exchange annotations
4+
version: 1.0.0
5+
6+
paths:
7+
/foo:
8+
post:
9+
requestBody:
10+
content:
11+
application/json:
12+
schema:
13+
$ref: '#/components/schemas/Foo'
14+
required: true
15+
responses:
16+
'201':
17+
description: result
18+
content:
19+
application/json:
20+
schema:
21+
$ref: '#/components/schemas/Foo'
22+
23+
components:
24+
schemas:
25+
Foo:
26+
type: object
27+
properties:
28+
foo:
29+
type: string
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.1.0
2+
info:
3+
title: test request/response with exchange annotations
4+
version: 1.0.0
5+
6+
paths:
7+
/foo:
8+
post:
9+
requestBody:
10+
content:
11+
application/json:
12+
schema:
13+
$ref: '#/components/schemas/Foo'
14+
required: true
15+
responses:
16+
'201':
17+
description: result
18+
content:
19+
application/json:
20+
schema:
21+
$ref: '#/components/schemas/Foo'
22+
23+
components:
24+
schemas:
25+
Foo:
26+
type: object
27+
properties:
28+
foo:
29+
type: string
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
openapi: 3.2.0
2+
info:
3+
title: test request/response with exchange annotations
4+
version: 1.0.0
5+
6+
paths:
7+
/foo:
8+
post:
9+
requestBody:
10+
content:
11+
application/json:
12+
schema:
13+
$ref: '#/components/schemas/Foo'
14+
required: true
15+
responses:
16+
'201':
17+
description: result
18+
content:
19+
application/json:
20+
schema:
21+
$ref: '#/components/schemas/Foo'
22+
23+
components:
24+
schemas:
25+
Foo:
26+
type: object
27+
properties:
28+
foo:
29+
type: string
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
prefix: generated
2+
items:
3+
- outputs/api/Api.java
4+
- outputs/model/<model>/Foo.java
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package generated.api;
2+
3+
import generated.model.Foo;
4+
import generated.support.Generated;
5+
import org.springframework.http.HttpStatus;
6+
import org.springframework.web.bind.annotation.RequestBody;
7+
import org.springframework.web.bind.annotation.ResponseStatus;
8+
import org.springframework.web.service.annotation.PostExchange;
9+
10+
@Generated(value = "openapi-processor-spring", version = "test")
11+
public interface Api {
12+
13+
@ResponseStatus(HttpStatus.CREATED)
14+
@PostExchange(url = "/foo", contentType = "application/json", accept = {"application/json"})
15+
Foo postFoo(@RequestBody Foo body);
16+
17+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package generated.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import generated.support.Generated;
5+
6+
@Generated(value = "openapi-processor-spring", version = "test")
7+
public class Foo {
8+
9+
@JsonProperty("foo")
10+
private String foo;
11+
12+
public String getFoo() {
13+
return foo;
14+
}
15+
16+
public void setFoo(String foo) {
17+
this.foo = foo;
18+
}
19+
20+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package generated.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import generated.support.Generated;
5+
6+
@Generated(value = "openapi-processor-spring", version = "test")
7+
public record Foo(
8+
@JsonProperty("foo")
9+
String foo
10+
) {}

0 commit comments

Comments
 (0)