File tree Expand file tree Collapse file tree 2 files changed +107
-0
lines changed
modules/swagger-codegen/src/test
java/io/swagger/codegen/v3/service Expand file tree Collapse file tree 2 files changed +107
-0
lines changed Original file line number Diff line number Diff line change 18
18
19
19
public class GeneratorServiceTest {
20
20
21
+ @ Test (description = "test generator oneOf ComposedSchema Properties" )
22
+ public void testGenerator_OneOf_ComposedSchemaProperties () throws IOException {
23
+
24
+ String path = getTmpFolder ().getAbsolutePath ();
25
+ GenerationRequest request = new GenerationRequest ();
26
+ request
27
+ .codegenVersion (GenerationRequest .CodegenVersion .V3 )
28
+ .type (GenerationRequest .Type .CLIENT )
29
+ .lang ("html" )
30
+ .spec (loadSpecAsNode ("3_0_0/OneOfPropertiesIssue.yaml" , true , false ))
31
+ .options (
32
+ new Options ()
33
+ .outputDir (path )
34
+ );
35
+
36
+ List <File > files = new GeneratorService ().generationRequest (request ).generate ();
37
+ Assert .assertFalse (files .isEmpty ());
38
+ for (File f : files ) {
39
+ String relPath = f .getAbsolutePath ().substring (path .length ());
40
+ if ("/index.html" .equals (relPath )) {
41
+ //val_Member unique property
42
+ Assert .assertTrue (FileUtils .readFileToString (f ).contains ("val_unique_reference" ));
43
+ //val_Member_Product unique property
44
+ Assert .assertTrue (FileUtils .readFileToString (f ).contains ("val_property_1" ));
45
+ }
46
+ }
47
+
48
+ }
49
+
21
50
@ Test (description = "test generator service with jaxrs-cxf-client" )
22
51
public void testGeneratorService_Jaxrs_cxf_client () throws IOException {
23
52
Original file line number Diff line number Diff line change
1
+ ---
2
+ openapi : 3.0.2
3
+ info :
4
+ description : " Description"
5
+ title : Title
6
+ version : v2
7
+ paths :
8
+ " /validation " :
9
+ post :
10
+ tags :
11
+ - Validation Data
12
+ summary : Validation Data
13
+ requestBody :
14
+ required : true
15
+ content :
16
+ application/json :
17
+ schema :
18
+ " $ref " : " #/components/schemas/mtg_Message"
19
+ responses :
20
+ ' 200 ' :
21
+ description : responses description
22
+ content :
23
+ application/xml :
24
+ schema :
25
+ " $ref " : " #/components/schemas/mtg_Message"
26
+ components :
27
+ schemas :
28
+ val_Member :
29
+ additionalProperties : false
30
+ description : valMember
31
+ properties :
32
+ val_unique_reference :
33
+ description : val unique reference
34
+ " $ref " : " #/components/schemas/val_TypeCode"
35
+ val_country :
36
+ description : val country
37
+ " $ref " : " #/components/schemas/val_Country"
38
+ val_products :
39
+ description : Products
40
+ " $ref " : " #/components/schemas/val_Products"
41
+ oneOf :
42
+ - required :
43
+ - val_products
44
+ - required :
45
+ - val_country
46
+ xml :
47
+ prefix : val
48
+ name : member
49
+ type : object
50
+ val_MemberProduct :
51
+ additionalProperties : false
52
+ description : Member Product Description
53
+ properties :
54
+ val_property_1 :
55
+ description : property 1
56
+ " $ref " : " #/components/schemas/val_Property_1"
57
+ val_property_2 :
58
+ description : property 2
59
+ " $ref " : " #/components/schemas/val_Property_2"
60
+ val_property_3 :
61
+ description : property 3
62
+ " $ref " : " #/components/schemas/val_Property_3"
63
+ val_property_4 :
64
+ description : property 4
65
+ " $ref " : " #/components/schemas/val_Property_4"
66
+ oneOf :
67
+ - required :
68
+ - val_property_1
69
+ - required :
70
+ - val_property_2
71
+ - required :
72
+ - val_property_3
73
+ - required :
74
+ - val_property_4
75
+ xml :
76
+ prefix : val
77
+ name : product
78
+ type : object
You can’t perform that action at this time.
0 commit comments