Skip to content

Commit 7e57371

Browse files
committed
Compatibility test ReadOnly
1 parent dbdf674 commit 7e57371

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 ReadOnlyBCTest {
10+
private final String BASE = "bc_readonly_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_readonly_changed_but_compatible.yaml");
20+
}
21+
22+
@Test
23+
public void requestReadOnlyIncreased() {
24+
assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_increased.yaml");
25+
}
26+
27+
@Test
28+
public void requestReadOnlyRequiredDecreased() {
29+
// TODO: Document why desired or remove support (test added to avoid unintentional regression)
30+
assertOpenApiBackwardIncompatible(BASE, "bc_request_readonly_required_decreased.yaml");
31+
}
32+
}
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+
readOnly: true
19+
prop2:
20+
type: string
21+
required:
22+
- prop1
23+
responses:
24+
'200':
25+
description: successful operation
26+
content:
27+
application/json:
28+
schema:
29+
type: object
30+
properties:
31+
prop1:
32+
type: string
33+
readOnly: true
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+
readOnly: true
19+
prop2:
20+
type: string
21+
required:
22+
- prop1
23+
responses:
24+
'200':
25+
description: successful operation
26+
content:
27+
application/json:
28+
schema:
29+
type: object
30+
properties:
31+
prop1:
32+
type: string
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+
readOnly: true
19+
prop2:
20+
type: string
21+
readOnly: true
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+
readOnly: true
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+
prop2:
19+
type: string
20+
required:
21+
- prop1
22+
responses:
23+
'200':
24+
description: successful operation
25+
content:
26+
application/json:
27+
schema:
28+
type: object
29+
properties:
30+
prop1:
31+
type: string
32+
readOnly: true

0 commit comments

Comments
 (0)