Skip to content

Commit 0fb2408

Browse files
committed
Compatibility test Required
1 parent 8bb45a9 commit 0fb2408

File tree

5 files changed

+196
-0
lines changed

5 files changed

+196
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.openapitools.openapidiff.core.backcompat;
2+
3+
import static org.openapitools.openapidiff.core.TestUtils.assertOpenApiBackwardIncompatible;
4+
import static org.openapitools.openapidiff.core.TestUtils.assertSpecChangedButCompatible;
5+
import static org.openapitools.openapidiff.core.TestUtils.assertSpecUnchanged;
6+
7+
import org.junit.jupiter.api.Test;
8+
9+
public class RequiredBCTest {
10+
11+
private final String BASE = "bc_required_base.yaml";
12+
13+
@Test
14+
public void unchanged() {
15+
assertSpecUnchanged(BASE, BASE);
16+
}
17+
18+
@Test
19+
public void changedButCompatible() {
20+
assertSpecChangedButCompatible(BASE, "bc_required_changed_but_compatible.yaml");
21+
}
22+
23+
@Test
24+
public void requestRequiredIncreased() {
25+
assertOpenApiBackwardIncompatible(BASE, "bc_request_required_increased.yaml");
26+
}
27+
28+
@Test
29+
public void responseRequiredDecreased() {
30+
assertOpenApiBackwardIncompatible(BASE, "bc_response_required_decreased.yaml");
31+
}
32+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
openapi: 3.0.0
2+
info:
3+
description: myDesc
4+
title: myTitle
5+
version: 1.0.0
6+
paths:
7+
/widgets:
8+
post:
9+
operationId: widgetCreate
10+
requestBody:
11+
content:
12+
application/json:
13+
schema:
14+
type: object
15+
properties:
16+
prop1:
17+
type: string
18+
prop2:
19+
type: string
20+
prop3:
21+
type: string
22+
required:
23+
- prop1
24+
- prop2
25+
- prop3
26+
responses:
27+
'200':
28+
description: successful operation
29+
content:
30+
application/json:
31+
schema:
32+
type: object
33+
properties:
34+
prop1:
35+
type: string
36+
prop2:
37+
type: string
38+
prop3:
39+
type: string
40+
required:
41+
- prop1
42+
- prop2
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
openapi: 3.0.0
2+
info:
3+
description: myDesc
4+
title: myTitle
5+
version: 1.0.0
6+
paths:
7+
/widgets:
8+
post:
9+
operationId: widgetCreate
10+
requestBody:
11+
content:
12+
application/json:
13+
schema:
14+
type: object
15+
properties:
16+
prop1:
17+
type: string
18+
prop2:
19+
type: string
20+
prop3:
21+
type: string
22+
required:
23+
- prop1
24+
- prop2
25+
responses:
26+
'200':
27+
description: successful operation
28+
content:
29+
application/json:
30+
schema:
31+
type: object
32+
properties:
33+
prop1:
34+
type: string
35+
prop2:
36+
type: string
37+
prop3:
38+
type: string
39+
required:
40+
- prop1
41+
- prop2
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
openapi: 3.0.0
2+
info:
3+
description: myDesc
4+
title: myTitle
5+
version: 1.0.0
6+
paths:
7+
/widgets:
8+
post:
9+
operationId: widgetCreate
10+
requestBody:
11+
content:
12+
application/json:
13+
schema:
14+
type: object
15+
properties:
16+
prop1:
17+
type: string
18+
prop2:
19+
type: string
20+
prop3:
21+
type: string
22+
required:
23+
- prop1
24+
responses:
25+
'200':
26+
description: successful operation
27+
content:
28+
application/json:
29+
schema:
30+
type: object
31+
properties:
32+
prop1:
33+
type: string
34+
prop2:
35+
type: string
36+
prop3:
37+
type: string
38+
required:
39+
- prop1
40+
- prop2
41+
- prop3
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
openapi: 3.0.0
2+
info:
3+
description: myDesc
4+
title: myTitle
5+
version: 1.0.0
6+
paths:
7+
/widgets:
8+
post:
9+
operationId: widgetCreate
10+
requestBody:
11+
content:
12+
application/json:
13+
schema:
14+
type: object
15+
properties:
16+
prop1:
17+
type: string
18+
prop2:
19+
type: string
20+
prop3:
21+
type: string
22+
required:
23+
- prop1
24+
- prop2
25+
responses:
26+
'200':
27+
description: successful operation
28+
content:
29+
application/json:
30+
schema:
31+
type: object
32+
properties:
33+
prop1:
34+
type: string
35+
prop2:
36+
type: string
37+
prop3:
38+
type: string
39+
required:
40+
- prop1

0 commit comments

Comments
 (0)