forked from loafle/openapi-generator-original
to fix loop for allof with single element in normalizer (#17426)
This commit is contained in:
@@ -573,6 +573,10 @@ public class OpenAPINormalizer {
|
||||
return;
|
||||
}
|
||||
|
||||
if (schema.getAllOf().size() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Object item : schema.getAllOf()) {
|
||||
if (!(item instanceof Schema)) {
|
||||
throw new RuntimeException("Error! allOf schema is not of the type Schema: " + item);
|
||||
|
||||
@@ -2022,7 +2022,7 @@ public class JavaClientCodegenTest {
|
||||
generator.setGeneratorPropertyDefault(CodegenConstants.APIS, "true");
|
||||
List<File> files = generator.opts(clientOptInput).generate();
|
||||
|
||||
Assert.assertEquals(files.size(), 24);
|
||||
Assert.assertEquals(files.size(), 27);
|
||||
validateJavaSourceFiles(files);
|
||||
|
||||
TestUtils.assertFileContains(
|
||||
|
||||
@@ -96,4 +96,9 @@ components:
|
||||
mum_or_dad:
|
||||
type: string
|
||||
required:
|
||||
- isParent
|
||||
- isParent
|
||||
allOfWithSingleItem:
|
||||
description: allOf with a single item
|
||||
nullable: true
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/AnotherParent'
|
||||
Reference in New Issue
Block a user