Skip to content

Commit ca5b2e6

Browse files
committed
test all vars
1 parent e91cde1 commit ca5b2e6

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4889,4 +4889,20 @@ public void testWebhooks() throws IOException {
48894889
Assert.assertEquals(co.operationId, "newPetGet");
48904890
}
48914891

4892+
@Test
4893+
public void testAllOf() throws IOException {
4894+
DefaultCodegen codegen = new DefaultCodegen();
4895+
final OpenAPI openAPI = TestUtils.parseFlattenSpec("src/test/resources/3_0/spring/issue_16797.yaml");
4896+
codegen.setOpenAPI(openAPI);
4897+
4898+
Schema object3 = openAPI.getComponents().getSchemas().get("Object3");
4899+
codegen.setOpenAPI(openAPI);
4900+
CodegenModel model = codegen.fromModel("Object3", object3);
4901+
Assert.assertEquals(names(model.allVars), List.of("timestamp", "pageInfo", "responseType", "requestId", "success"));
4902+
System.out.println(names(model.allVars));
4903+
}
4904+
4905+
static List<String> names(List<CodegenProperty> vars) {
4906+
return vars.stream().map(CodegenProperty::getBaseName).collect(Collectors.toList());
4907+
}
48924908
}

modules/openapi-generator/src/test/resources/3_0/spring/issue_16797.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ components:
7474
allOf:
7575
- $ref: '#/components/schemas/Object2'
7676
properties:
77+
timestamp:
78+
type: string
79+
format: date-time
7780
pageInfo:
7881
$ref: '#/components/schemas/Type1'
7982
required:

0 commit comments

Comments
 (0)