Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit b935039

Browse files
committed
update/extend multi response test case, #68
1 parent 64debf8 commit b935039

File tree

15 files changed

+129
-1
lines changed

15 files changed

+129
-1
lines changed

src/testInt/groovy/io/openapiprocessor/core/TestSets.groovy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ class TestSets {
3939
'ref-to-escaped-path-name',
4040
'response-array-data-type-mapping',
4141
'response-complex-data-types',
42-
'response-content-multiple',
4342
'response-content-multiple-no-content',
43+
'response-content-multiple-style-all',
44+
'response-content-multiple-style-success',
4445
'response-content-single',
4546
'response-result-mapping',
4647
'response-simple-data-types',
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
items:
22
- inputs/openapi.yaml
3+
- inputs/mapping.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
openapi-processor-mapping: v2
2+
3+
options:
4+
package-name: generated
5+
6+
map:
7+
result-style: all
8+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
items:
2+
- generated/api/Api.java
3+
- generated/model/Error.java
4+
- generated/model/Foo.java
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-processor-core.
3+
* TEST ONLY.
4+
*/
5+
6+
package generated.api;
7+
8+
import annotation.Mapping;
9+
import generated.model.Foo;
10+
11+
public interface Api {
12+
13+
@Mapping("/foo")
14+
Foo getFooApplicationJson();
15+
16+
@Mapping("/foo")
17+
String getFooTextPlain();
18+
19+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-processor-core.
3+
* TEST ONLY.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
public class Error {
11+
12+
@JsonProperty("error")
13+
private String error;
14+
15+
public String getError() {
16+
return error;
17+
}
18+
19+
public void setError(String error) {
20+
this.error = error;
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* This class is auto generated by https://github.com/hauner/openapi-processor-core.
3+
* TEST ONLY.
4+
*/
5+
6+
package generated.model;
7+
8+
import com.fasterxml.jackson.annotation.JsonProperty;
9+
10+
public class Foo {
11+
12+
@JsonProperty("bar")
13+
private String bar;
14+
15+
public String getBar() {
16+
return bar;
17+
}
18+
19+
public void setBar(String bar) {
20+
this.bar = bar;
21+
}
22+
23+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
items:
2+
- inputs/openapi.yaml
3+
- inputs/mapping.yaml
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
openapi-processor-mapping: v2
2+
3+
options:
4+
package-name: generated
5+
6+
map:
7+
# result-style: success # default
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
openapi: 3.0.2
2+
info:
3+
title: test multiple response contents
4+
version: 1.0.0
5+
6+
paths:
7+
/foo:
8+
get:
9+
responses:
10+
'200':
11+
description: json or plain text result
12+
content:
13+
application/json:
14+
schema:
15+
$ref: '#/components/schemas/Foo'
16+
text/plain:
17+
schema:
18+
type: string
19+
default:
20+
description: error
21+
content:
22+
application/xml:
23+
schema:
24+
$ref: '#/components/schemas/Error'
25+
26+
components:
27+
28+
schemas:
29+
Foo:
30+
type: object
31+
properties:
32+
bar:
33+
type: string
34+
35+
Error:
36+
type: object
37+
properties:
38+
error:
39+
type: string

0 commit comments

Comments
 (0)