Skip to content

Commit 1524342

Browse files
committed
Compatibility test WriteOnly
1 parent 9671ac3 commit 1524342

File tree

5 files changed

+163
-0
lines changed

5 files changed

+163
-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 WriteOnlyBCTest {
10+
private final String BASE = "bc_writeonly_base.yaml";
11+
12+
@Test
13+
public void unchanged() {
14+
assertSpecUnchanged(BASE, BASE);
15+
}
16+
17+
@Test
18+
public void changedButCompatible() {
19+
assertSpecChangedButCompatible(BASE, "bc_writeonly_changed_but_compatible.yaml");
20+
}
21+
22+
@Test
23+
public void responseWriteOnlyIncreased() {
24+
assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_increased.yaml");
25+
}
26+
27+
@Test
28+
public void responseWriteOnlyRequiredDecreased() {
29+
// TODO: Document why desired or remove support (test added to avoid unintentional regression)
30+
assertOpenApiBackwardIncompatible(BASE, "bc_response_writeonly_required_decreased.yaml");
31+
}
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
writeOnly: true
19+
responses:
20+
'200':
21+
description: successful operation
22+
content:
23+
application/json:
24+
schema:
25+
type: object
26+
properties:
27+
prop1:
28+
type: string
29+
writeOnly: true
30+
prop2:
31+
type: string
32+
writeOnly: true
33+
required:
34+
- prop1
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
writeOnly: true
19+
responses:
20+
'200':
21+
description: successful operation
22+
content:
23+
application/json:
24+
schema:
25+
type: object
26+
properties:
27+
prop1:
28+
type: string
29+
prop2:
30+
type: string
31+
required:
32+
- prop1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
writeOnly: true
19+
responses:
20+
'200':
21+
description: successful operation
22+
content:
23+
application/json:
24+
schema:
25+
type: object
26+
properties:
27+
prop1:
28+
type: string
29+
writeOnly: true
30+
prop2:
31+
type: string
32+
required:
33+
- prop1
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
responses:
19+
'200':
20+
description: successful operation
21+
content:
22+
application/json:
23+
schema:
24+
type: object
25+
properties:
26+
prop1:
27+
type: string
28+
writeOnly: true
29+
prop2:
30+
type: string
31+
required:
32+
- prop1

0 commit comments

Comments
 (0)