File tree 3 files changed +189
-0
lines changed
java/org/openapitools/openapidiff/core
3 files changed +189
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .openapitools .openapidiff .core ;
2
+
3
+ import static org .assertj .core .api .Assertions .assertThat ;
4
+
5
+ import org .junit .jupiter .api .Test ;
6
+ import org .openapitools .openapidiff .core .model .ChangedOpenApi ;
7
+
8
+ public class AllOfOneOfDiffTest {
9
+ @ Test
10
+ void allOfReferringToOneOfSchemasAreSupported () {
11
+ ChangedOpenApi diff = OpenApiCompare .fromLocations ("issue-317_1.json" , "issue-317_2.json" );
12
+ assertThat (diff .isCoreChanged ().isUnchanged ());
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" :" 3.0.0" ,
3
+ "info" :{
4
+ "title" :" API" ,
5
+ "version" :" 0.1.0"
6
+ },
7
+ "paths" :{
8
+ "/resource" :{
9
+ "post" :{
10
+ "responses" :{
11
+ "200" :{
12
+ "description" :" Created resource" ,
13
+ "content" :{
14
+ "application/json" :{
15
+ "schema" :{
16
+ "type" :" string"
17
+ }
18
+ }
19
+ }
20
+ }
21
+ },
22
+ "summary" :" Create resource" ,
23
+ "requestBody" :{
24
+ "content" :{
25
+ "application/json" :{
26
+ "schema" :{
27
+ "$ref" :" #/components/schemas/Resource"
28
+ }
29
+ }
30
+ },
31
+ "description" :" Definition of the resource"
32
+ }
33
+ }
34
+ }
35
+ },
36
+ "components" :{
37
+ "schemas" :{
38
+ "Resource" :{
39
+ "type" :" object" ,
40
+ "properties" :{
41
+ "assignment" :{
42
+ "$ref" :" #/components/schemas/Foo"
43
+ }
44
+ }
45
+ },
46
+ "Foo" :{
47
+ "oneOf" :[
48
+ {
49
+ "$ref" :" #/components/schemas/Foo.Bar"
50
+ },
51
+ {
52
+ "$ref" :" #/components/schemas/Foo.Baz"
53
+ }
54
+ ],
55
+ "discriminator" :{
56
+ "propertyName" :" type" ,
57
+ "mapping" :{
58
+ "Bar" :" #/components/schemas/Foo.Bar" ,
59
+ "Baz" :" #/components/schemas/Foo.Baz"
60
+ }
61
+ }
62
+ },
63
+ "Foo.Bar" :{
64
+ "type" :" object" ,
65
+ "properties" :{
66
+ "type" :{
67
+ "type" :" string"
68
+ }
69
+ }
70
+ },
71
+ "Foo.Baz" :{
72
+ "type" :" object" ,
73
+ "properties" :{
74
+ "type" :{
75
+ "type" :" string"
76
+ }
77
+ }
78
+ }
79
+ },
80
+ "securitySchemes" :{
81
+
82
+ }
83
+ }
84
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" :" 3.0.0" ,
3
+ "info" :{
4
+ "title" :" API" ,
5
+ "version" :" 0.1.0"
6
+ },
7
+ "paths" :{
8
+ "/resource" :{
9
+ "post" :{
10
+ "responses" :{
11
+ "200" :{
12
+ "description" :" Created resource" ,
13
+ "content" :{
14
+ "application/json" :{
15
+ "schema" :{
16
+ "type" :" string"
17
+ }
18
+ }
19
+ }
20
+ }
21
+ },
22
+ "summary" :" Create resource" ,
23
+ "requestBody" :{
24
+ "content" :{
25
+ "application/json" :{
26
+ "schema" :{
27
+ "$ref" :" #/components/schemas/Resource"
28
+ }
29
+ }
30
+ },
31
+ "description" :" Definition of the resource"
32
+ }
33
+ }
34
+ }
35
+ },
36
+ "components" :{
37
+ "schemas" :{
38
+ "Resource" :{
39
+ "type" :" object" ,
40
+ "properties" :{
41
+ "assignment" :{
42
+ "default" :{
43
+ "type" :" Bar"
44
+ },
45
+ "allOf" :[
46
+ {
47
+ "$ref" :" #/components/schemas/Foo"
48
+ }
49
+ ]
50
+ }
51
+ }
52
+ },
53
+ "Foo" :{
54
+ "oneOf" :[
55
+ {
56
+ "$ref" :" #/components/schemas/Foo.Bar"
57
+ },
58
+ {
59
+ "$ref" :" #/components/schemas/Foo.Baz"
60
+ }
61
+ ],
62
+ "discriminator" :{
63
+ "propertyName" :" type" ,
64
+ "mapping" :{
65
+ "Bar" :" #/components/schemas/Foo.Bar" ,
66
+ "Baz" :" #/components/schemas/Foo.Baz"
67
+ }
68
+ }
69
+ },
70
+ "Foo.Bar" :{
71
+ "type" :" object" ,
72
+ "properties" :{
73
+ "type" :{
74
+ "type" :" string"
75
+ }
76
+ }
77
+ },
78
+ "Foo.Baz" :{
79
+ "type" :" object" ,
80
+ "properties" :{
81
+ "type" :{
82
+ "type" :" string"
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "securitySchemes" :{
88
+
89
+ }
90
+ }
91
+ }
You can’t perform that action at this time.
0 commit comments