Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,35 @@

public class GeneratorServiceTest {

@Test(description = "test generator oneOf ComposedSchema Properties")
public void testGenerator_OneOf_ComposedSchemaProperties() throws IOException {

String path = getTmpFolder().getAbsolutePath();
GenerationRequest request = new GenerationRequest();
request
.codegenVersion(GenerationRequest.CodegenVersion.V3)
.type(GenerationRequest.Type.CLIENT)
.lang("html")
.spec(loadSpecAsNode("3_0_0/OneOfPropertiesIssue.yaml", true, false))
.options(
new Options()
.outputDir(path)
);

List<File> files = new GeneratorService().generationRequest(request).generate();
Assert.assertFalse(files.isEmpty());
for (File f: files) {
String relPath = f.getAbsolutePath().substring(path.length());
if ("/index.html".equals(relPath)) {
//val_Member unique property
Assert.assertTrue(FileUtils.readFileToString(f).contains("val_unique_reference"));
//val_Member_Product unique property
Assert.assertTrue(FileUtils.readFileToString(f).contains("val_property_1"));
}
}

}

@Test(description = "test generator service with jaxrs-cxf-client")
public void testGeneratorService_Jaxrs_cxf_client() throws IOException {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
openapi: 3.0.2
info:
description: "Description"
title: Title
version: v2
paths:
"/validation":
post:
tags:
- Validation Data
summary: Validation Data
requestBody:
required: true
content:
application/json:
schema:
"$ref": "#/components/schemas/mtg_Message"
responses:
'200':
description: responses description
content:
application/xml:
schema:
"$ref": "#/components/schemas/mtg_Message"
components:
schemas:
val_Member:
additionalProperties: false
description: valMember
properties:
val_unique_reference:
description: val unique reference
"$ref": "#/components/schemas/val_TypeCode"
val_country:
description: val country
"$ref": "#/components/schemas/val_Country"
val_products:
description: Products
"$ref": "#/components/schemas/val_Products"
oneOf:
- required:
- val_products
- required:
- val_country
xml:
prefix: val
name: member
type: object
val_MemberProduct:
additionalProperties: false
description: Member Product Description
properties:
val_property_1:
description: property 1
"$ref": "#/components/schemas/val_Property_1"
val_property_2:
description: property 2
"$ref": "#/components/schemas/val_Property_2"
val_property_3:
description: property 3
"$ref": "#/components/schemas/val_Property_3"
val_property_4:
description: property 4
"$ref": "#/components/schemas/val_Property_4"
oneOf:
- required:
- val_property_1
- required:
- val_property_2
- required:
- val_property_3
- required:
- val_property_4
xml:
prefix: val
name: product
type: object