File tree Expand file tree Collapse file tree 7 files changed +321
-0
lines changed
java/io/swagger/codegen/v3/generators/java
resources/3_0_0/composedFlatten Expand file tree Collapse file tree 7 files changed +321
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .swagger .codegen .v3 .generators .java ;
2
+
3
+ import io .swagger .codegen .v3 .generators .GeneratorRunner ;
4
+ import io .swagger .codegen .v3 .service .GenerationRequest ;
5
+ import org .testng .Assert ;
6
+ import org .testng .annotations .Test ;
7
+
8
+ import java .io .File ;
9
+ import java .util .List ;
10
+
11
+ public class GeneratorResultTestJava {
12
+
13
+
14
+ @ Test
15
+ public void testJavaGenerator_OneOf () throws Exception {
16
+
17
+ String name = "java" ;
18
+ String specPath = "3_0_0/composedFlatten/allof_inline_ref.yaml" ;
19
+ GenerationRequest .CodegenVersion codegenVersion = GenerationRequest .CodegenVersion .V3 ;
20
+ boolean v2Spec = false ; // 3.0 spec
21
+ boolean yaml = true ;
22
+ boolean flattenInlineComposedSchema = true ;
23
+ String outFolder = null ; // temporary folder
24
+
25
+ List <File > files = GeneratorRunner .runGenerator (
26
+ name ,
27
+ specPath ,
28
+ codegenVersion ,
29
+ v2Spec ,
30
+ yaml ,
31
+ flattenInlineComposedSchema ,
32
+ outFolder );
33
+
34
+ Assert .assertFalse (files .isEmpty ());
35
+ for (File f : files ) {
36
+ // TODO test stuff
37
+ }
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ oneOfInlineBar :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - type : object
41
+ properties :
42
+ schemaTestInline1Foo :
43
+ type : string
44
+ schemaTestInline1Ref :
45
+ type : array
46
+ items :
47
+ $ref : ' #/components/schemas/Bar'
48
+ - $ref : ' #/components/schemas/OneOfTest'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ oneOfInlineBar :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - type : object
41
+ properties :
42
+ schemaTestInline1Foo :
43
+ type : string
44
+ schemaTestInline1Ref :
45
+ type : array
46
+ items :
47
+ $ref : ' #/components/schemas/Bar'
48
+ - $ref : ' #/components/schemas/Foo'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ foo :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - $ref : ' #/components/schemas/OneOfTest'
41
+ - type : object
42
+ properties :
43
+ schemaTestInline1Foo :
44
+ type : string
45
+ schemaTestInline1Ref :
46
+ type : array
47
+ items :
48
+ $ref : ' #/components/schemas/Bar'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ foo :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - $ref : ' #/components/schemas/OneOfTest'
41
+ - type : object
42
+ properties :
43
+ schemaTestInline1Foo :
44
+ type : string
45
+ schemaTestInline1Ref :
46
+ type : array
47
+ items :
48
+ $ref : ' #/components/schemas/Bar'
49
+ - type : object
50
+ properties :
51
+ schemaTestInline2Foo :
52
+ type : string
53
+ schemaTestInline2Ref :
54
+ type : array
55
+ items :
56
+ $ref : ' #/components/schemas/Bar'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ foo :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - $ref : ' #/components/schemas/OneOfTest'
41
+ - $ref : ' #/components/schemas/Bar'
Original file line number Diff line number Diff line change
1
+ openapi : 3.0.2
2
+ info :
3
+ title : CC-20717 test - OAS3
4
+ version : 1.0.0
5
+ paths :
6
+ /something :
7
+ get :
8
+ responses :
9
+ 200 :
10
+ description : ok
11
+ content :
12
+ application/json :
13
+ schema :
14
+ $ref : ' #/components/schemas/Bar'
15
+ components :
16
+ schemas :
17
+ Foo :
18
+ type : object
19
+ properties :
20
+ foo :
21
+ type : string
22
+ Bar :
23
+ type : object
24
+ properties :
25
+ foo1 :
26
+ description : An instance of Foo
27
+ allOf :
28
+ - $ref : ' #/components/schemas/Foo'
29
+ foo2 :
30
+ $ref : ' #/components/schemas/Foo'
31
+ OneOfTest :
32
+ oneOf :
33
+ - $ref : " #/components/schemas/Foo"
34
+ - type : object
35
+ properties :
36
+ foo :
37
+ type : string
38
+ SchemaTest :
39
+ allOf :
40
+ - $ref : ' #/components/schemas/Bar'
41
+ - $ref : ' #/components/schemas/OneOfTest'
You can’t perform that action at this time.
0 commit comments