Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4949f28
[BUG][Java][Spring][SpringBoot] optional array with 'minItems' set ge…
Jan 23, 2026
61e4916
[BUG][Java][Spring][SpringBoot] optional array with 'minItems' set ge…
kingofdisasterr Jan 23, 2026
c4c0239
[BUG] [HTML] Fix html array types (#22795)
madsvonqualen Jan 24, 2026
ab44f6e
Repaired partial_header include for generator csharp (#22442)
ACanisLupus Jan 24, 2026
dd4a722
Fix isRelativeUrl incorrectly detecting URLs containing @, -, ~, . as…
Romanow88 Jan 24, 2026
049e1ed
[swift6][client] make api calls concurrent (#22790)
4brunu Jan 24, 2026
9e33e20
[swift6][client] improve swift 6 thread safety (#22801)
4brunu Jan 24, 2026
e8aa450
[swift6][client] Add new hooks to OpenAPIInterceptor (#22800)
4brunu Jan 25, 2026
97080c9
[dotnet] update samples (#22803)
4brunu Jan 25, 2026
ddc2e3d
[swift6][client] Increase minimum supported SDK to accommodate swift …
4brunu Jan 25, 2026
f49b369
[swift6] fix Vapor build, disable swift 5 tests on CI and enable more…
4brunu Jan 25, 2026
7650f7f
build(deps): bump lodash (#22804)
dependabot[bot] Jan 26, 2026
7677dbb
Add create requestOpts method to {{classname}}Interface #21708 (#21709)
azertyalex Jan 26, 2026
cdbe28e
[BUG][typescript-angular] apiKeys cause service compilation errors (#…
saxicek Jan 26, 2026
75f5be9
[swift6][client] Remove unnecessary Combine checks (#22810)
4brunu Jan 26, 2026
f67080e
update TS samples
wing328 Jan 26, 2026
3644a20
Revert "Add create requestOpts method to {{classname}}Interface #2170…
macjohnny Jan 26, 2026
2fef10f
Generate request config typescript fetch v2 (#22815)
azertyalex Jan 26, 2026
334e8ee
[csharp][generichost] Add HTTP client name to fix client duplicity (#…
McMlok Jan 26, 2026
fb1298a
added xml comments and restrict some access (#22796)
devhl-labs Jan 26, 2026
633bb18
update c# samples
wing328 Jan 26, 2026
5177926
build(deps-dev): bump org.assertj:assertj-core (#22818)
dependabot[bot] Jan 27, 2026
9772009
[Rust] Update reqwest to 0.13 and reqwest-middleware to 0.5 (#22816)
adi-code Jan 27, 2026
3f87e8f
Update python-multipart to newer version (#22821)
wing328 Jan 27, 2026
2d23c0c
[python-fastapi] Set python version to 3.10 (#22823)
wing328 Jan 27, 2026
2f5c840
update assertj to newer version (#22824)
wing328 Jan 27, 2026
3b034f0
[php][php-nextgen] Fix nullability when multiple response types are p…
JulianVennen Jan 27, 2026
562111d
feat(typescript): Update isomorphic-fetch file to allow for response …
Rezrazi Jan 27, 2026
46deae3
Merge remote-tracking branch 'refs/remotes/origin/issue_22784' into i…
Jan 27, 2026
93dece7
generated samples
kingofdisasterr Jan 27, 2026
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 @@ -1326,8 +1326,8 @@ public String toDefaultValue(CodegenProperty cp, Schema schema) {
// if default to empty container option is set, respect the default values provided in the spec
return toArrayDefaultValue(cp, schema);
} else if (schema.getDefault() == null) {
// nullable or containerDefaultToNull set to true
if (cp.isNullable || containerDefaultToNull) {
// nullable or containerDefaultToNull set to true or an optional array with minItems > 0
if (cp.isNullable || containerDefaultToNull || (cp.minItems != null && cp.minItems > 0 && !cp.getHasRequired())) {
return null;
}
return getDefaultCollectionType(schema);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,6 @@ public void shouldGenerateDefaultValueForEnumRequestParameter() throws IOExcepti
assertFileContains(Paths.get(outputPath + "/src/main/java/org/openapitools/api/GetApi.java"),
"@RequestParam(value = \"testParameter1\", required = false, defaultValue = \"BAR\")",
"@RequestParam(value = \"TestParameter2\", required = false, defaultValue = \"BAR\")");

}

/**
Expand Down Expand Up @@ -5075,7 +5074,36 @@ public void optionalListShouldBeEmpty() throws IOException {
JavaFileAssert.assertThat(files.get("PetDto.java"))
.fileContains("private List<@Valid TagDto> tags = new ArrayList<>();")
.fileContains("private List<String> photoUrls = new ArrayList<>();");
}

@Test
public void testOptionalListWithMinItems1ShouldBeNull_issue_22784() throws IOException {
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
output.deleteOnExit();

OpenAPI openAPI = new OpenAPIParser()
.readLocation("src/test/resources/3_1/issue_22784.yaml", null, new ParseOptions()).getOpenAPI();
SpringCodegen codegen = new SpringCodegen();
codegen.setOutputDir(output.getAbsolutePath());
codegen.additionalProperties().put(INTERFACE_ONLY, "true");
codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.model");
codegen.additionalProperties().put(CodegenConstants.API_NAME_SUFFIX, "Controller");
codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.controller");
codegen.additionalProperties().put(CodegenConstants.MODEL_NAME_SUFFIX, "Dto");

ClientOptInput input = new ClientOptInput()
.openAPI(openAPI)
.config(codegen);

DefaultGenerator generator = new DefaultGenerator();
generator.setGenerateMetadata(false); // skip metadata and ↓ only generate models
generator.setGeneratorPropertyDefault(CodegenConstants.MODELS, "true");

Map<String, File> files = generator.opts(input).generate().stream()
.collect(Collectors.toMap(File::getName, Function.identity()));

JavaFileAssert.assertThat(files.get("FooBarRequestDto.java"))
.fileContains("private @Nullable List<@Valid BarDto> barList;");
}

@Test
Expand Down
45 changes: 45 additions & 0 deletions modules/openapi-generator/src/test/resources/3_1/issue_22784.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
openapi: 3.1.1
info:
title: Optional Array with minItems 1 OpenAPI Example
version: 1.0.0
paths:
/foo-bar:
put:
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/FooBarRequest'
responses:
204:
description: success

components:
schemas:
FooBarRequest:
type: object
properties:
foo:
properties:
name:
type: string
required:
- name
barList:
description: |
This array is optional. If provided, it must contain between 1 and 3 items
type: array
items:
$ref: '#/components/schemas/Bar'
minItems: 1
maxItems: 3
required:
- foo
Bar:
type: object
properties:
someProperty:
type: string
required:
- someProperty
Loading