Skip to content

Commit 246f422

Browse files
committed
Compatibility test Enum
1 parent ea09c2b commit 246f422

File tree

5 files changed

+163
-0
lines changed

5 files changed

+163
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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 EnumBCTest {
10+
private final String BASE = "bc_enum_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_enum_changed_but_compatible.yaml");
20+
}
21+
22+
@Test
23+
public void requestDecreased() {
24+
assertOpenApiBackwardIncompatible(BASE, "bc_request_enum_decreased.yaml");
25+
}
26+
27+
@Test
28+
public void responseIncreased() {
29+
assertOpenApiBackwardIncompatible(BASE, "bc_response_enum_increased.yaml");
30+
}
31+
}
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+
get:
9+
operationId: listWidgets
10+
parameters:
11+
- name: param-inline-enum
12+
in: query
13+
required: true
14+
schema:
15+
type: string
16+
enum:
17+
- param-inline-enum-val-1
18+
- param-inline-enum-val-2
19+
default: param-inline-enum-val-1
20+
responses:
21+
'200':
22+
description: successful operation
23+
content:
24+
application/json:
25+
schema:
26+
type: object
27+
properties:
28+
enum-prop:
29+
type: string
30+
enum:
31+
- enum-prop-val-1
32+
- enum-prop-val-2
33+
default: enum-prop-val-1
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+
get:
9+
operationId: listWidgets
10+
parameters:
11+
- name: param-inline-enum
12+
in: query
13+
required: true
14+
schema:
15+
type: string
16+
enum:
17+
- param-inline-enum-val-1
18+
- param-inline-enum-val-2
19+
- param-inline-enum-val-3
20+
default: param-inline-enum-val-1
21+
responses:
22+
'200':
23+
description: successful operation
24+
content:
25+
application/json:
26+
schema:
27+
type: object
28+
properties:
29+
enum-prop:
30+
type: string
31+
enum:
32+
- enum-prop-val-1
33+
default: enum-prop-val-1
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+
get:
9+
operationId: listWidgets
10+
parameters:
11+
- name: param-inline-enum
12+
in: query
13+
required: true
14+
schema:
15+
type: string
16+
enum:
17+
- param-inline-enum-val-1
18+
default: param-inline-enum-val-1
19+
responses:
20+
'200':
21+
description: successful operation
22+
content:
23+
application/json:
24+
schema:
25+
type: object
26+
properties:
27+
enum-prop:
28+
type: string
29+
enum:
30+
- enum-prop-val-1
31+
- enum-prop-val-2
32+
default: enum-prop-val-1
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+
get:
9+
operationId: listWidgets
10+
parameters:
11+
- name: param-inline-enum
12+
in: query
13+
required: true
14+
schema:
15+
type: string
16+
enum:
17+
- param-inline-enum-val-1
18+
- param-inline-enum-val-2
19+
default: param-inline-enum-val-1
20+
responses:
21+
'200':
22+
description: successful operation
23+
content:
24+
application/json:
25+
schema:
26+
type: object
27+
properties:
28+
enum-prop:
29+
type: string
30+
enum:
31+
- enum-prop-val-1
32+
- enum-prop-val-2
33+
- enum-prop-val-3
34+
default: enum-prop-val-1

0 commit comments

Comments
 (0)