Skip to content

Commit d67c9fc

Browse files
committed
add integration test (#412)
1 parent 681d331 commit d67c9fc

File tree

11 files changed

+224
-1
lines changed

11 files changed

+224
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ class ProcessorPendingSpec: StringSpec({
3232

3333
private fun sources(): Collection<TestSet> {
3434
return listOf(
35-
testSet("params-enum", "INTERNAL", API_30),
35+
testSet("params-request-body-form-urlencoded", "INTERNAL", API_30),
3636
)
3737
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ val ALL_3x: List<TestParams2> = join(
1717
testX("params-path-simple-data-types"),
1818
testX("params-query-annotate-simple-mapping"),
1919
tests("params-request-body"),
20+
testX("params-request-body-form-urlencoded"),
2021
testX("params-request-body-multipart-mapping"),
2122
testX("params-simple-data-types"),
2223
testX("response-status")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
prefix: api
2+
items:
3+
- inputs/openapi30.yaml
4+
- inputs/openapi31.yaml
5+
- inputs/openapi32.yaml
6+
- inputs/mapping.yaml
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
openapi-processor-mapping: v17
2+
3+
options:
4+
package-name: generated
5+
format-code: false
6+
7+
map:
8+
paths:
9+
/foo/object:
10+
body-style: object
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
openapi: 3.0.2
2+
info:
3+
title: x-form-www-urlencoded
4+
version: 1.0.0
5+
6+
paths:
7+
/foo/params:
8+
post:
9+
requestBody:
10+
required: true
11+
content:
12+
application/x-www-form-urlencoded:
13+
schema:
14+
type: object
15+
properties:
16+
foo:
17+
type: string
18+
bar:
19+
type: string
20+
responses:
21+
'204':
22+
description: empty
23+
24+
/foo/object:
25+
post:
26+
requestBody:
27+
required: true
28+
content:
29+
application/x-www-form-urlencoded:
30+
schema:
31+
$ref: '#/components/schemas/Foo'
32+
responses:
33+
'204':
34+
description: empty
35+
36+
components:
37+
schemas:
38+
39+
Foo:
40+
type: object
41+
properties:
42+
foo:
43+
type: string
44+
bar:
45+
type: string
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
openapi: 3.1.0
2+
info:
3+
title: x-form-www-urlencoded
4+
version: 1.0.0
5+
6+
paths:
7+
/foo/params:
8+
post:
9+
requestBody:
10+
required: true
11+
content:
12+
application/x-www-form-urlencoded:
13+
schema:
14+
type: object
15+
properties:
16+
foo:
17+
type: string
18+
bar:
19+
type: string
20+
responses:
21+
'204':
22+
description: empty
23+
24+
/foo/object:
25+
post:
26+
requestBody:
27+
required: true
28+
content:
29+
application/x-www-form-urlencoded:
30+
schema:
31+
$ref: '#/components/schemas/Foo'
32+
responses:
33+
'204':
34+
description: empty
35+
36+
components:
37+
schemas:
38+
39+
Foo:
40+
type: object
41+
properties:
42+
foo:
43+
type: string
44+
bar:
45+
type: string
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
openapi: 3.2.0
2+
info:
3+
title: x-form-www-urlencoded
4+
version: 1.0.0
5+
6+
paths:
7+
/foo/params:
8+
post:
9+
requestBody:
10+
required: true
11+
content:
12+
application/x-www-form-urlencoded:
13+
schema:
14+
type: object
15+
properties:
16+
foo:
17+
type: string
18+
bar:
19+
type: string
20+
responses:
21+
'204':
22+
description: empty
23+
24+
/foo/object:
25+
post:
26+
requestBody:
27+
required: true
28+
content:
29+
application/x-www-form-urlencoded:
30+
schema:
31+
$ref: '#/components/schemas/Foo'
32+
responses:
33+
'204':
34+
description: empty
35+
36+
components:
37+
schemas:
38+
39+
Foo:
40+
type: object
41+
properties:
42+
foo:
43+
type: string
44+
bar:
45+
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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.PostMapping;
7+
import org.springframework.web.bind.annotation.RequestParam;
8+
import org.springframework.web.bind.annotation.ResponseStatus;
9+
10+
@Generated(value = "openapi-processor-spring", version = "test")
11+
public interface Api {
12+
13+
@ResponseStatus(HttpStatus.NO_CONTENT)
14+
@PostMapping(path = "/foo/params")
15+
void postFooParams(
16+
@RequestParam(name = "foo") String foo,
17+
@RequestParam(name = "bar") String bar);
18+
19+
@ResponseStatus(HttpStatus.NO_CONTENT)
20+
@PostMapping(path = "/foo/object")
21+
void postFooObject(Foo body);
22+
23+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
@JsonProperty("bar")
13+
private String bar;
14+
15+
public String getFoo() {
16+
return foo;
17+
}
18+
19+
public void setFoo(String foo) {
20+
this.foo = foo;
21+
}
22+
23+
public String getBar() {
24+
return bar;
25+
}
26+
27+
public void setBar(String bar) {
28+
this.bar = bar;
29+
}
30+
31+
}

0 commit comments

Comments
 (0)