Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
59c67f2
Merge pull request #4 from OpenAPITools/master
jpfinne May 11, 2026
784da69
Merge branch 'OpenAPITools:master' into master
jpfinne May 12, 2026
9ee6075
Merge branch 'OpenAPITools:master' into master
jpfinne May 14, 2026
91ce7ba
Merge branch 'OpenAPITools:master' into master
jpfinne May 15, 2026
0808d0e
Merge branch 'OpenAPITools:master' into master
jpfinne May 17, 2026
46d9c9c
Merge branch 'OpenAPITools:master' into master
jpfinne May 18, 2026
7b6cf90
Merge branch 'OpenAPITools:master' into master
jpfinne May 30, 2026
b50a337
Merge branch 'OpenAPITools:master' into master
jpfinne Jun 1, 2026
ae1bff7
Merge branch 'OpenAPITools:master' into master
jpfinne Jun 2, 2026
5229d8d
Merge branch 'OpenAPITools:master' into master
jpfinne Jun 3, 2026
cdc74eb
Merge branch 'OpenAPITools:master' into master
jpfinne Jun 13, 2026
9c059d1
Merge remote-tracking branch 'upstream/master'
jpfinne Jun 13, 2026
df30bd2
Merge branch 'OpenAPITools:master' into master
jpfinne Jul 4, 2026
246b21d
Merge branch 'OpenAPITools:master' into master
jpfinne Jul 8, 2026
8e39563
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 1, 2026
deec130
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 4, 2026
da9270c
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 8, 2026
7e4ce22
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 8, 2026
4f55095
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 9, 2026
a614eb2
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 10, 2026
12cb648
Merge remote-tracking branch 'upstream/master'
jpfinne Aug 12, 2026
e8f0a38
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 13, 2026
8199a48
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 18, 2026
4757c1f
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 19, 2026
9e1e82b
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 24, 2026
3f7b9f4
Merge remote-tracking branch 'refs/remotes/upstream/master'
jpfinne Aug 24, 2026
f89dba7
Merge branch 'OpenAPITools:master' into master
jpfinne Aug 30, 2026
73d1bd6
Merge branch 'OpenAPITools:master' into master
jpfinne Sep 8, 2026
e8789be
simplify test
jpfinne Sep 10, 2026
50b3b52
Merge branch 'OpenAPITools:master' into master
jpfinne Sep 10, 2026
f99f7ae
Merge remote-tracking branch 'origin/master'
jpfinne Sep 10, 2026
1f85b51
Merge branch 'OpenAPITools:master' into master
jpfinne Sep 28, 2026
3231e79
Feature: possibility to annotate type arguments in java List<>
jpfinne Sep 29, 2026
34ac7a9
Regenerate doc
jpfinne Sep 29, 2026
40508e7
Use standard x-field-extra-annotation instead of a new annotation
jpfinne Sep 29, 2026
2810b5b
Test annotation with items allOf
jpfinne Sep 29, 2026
e311c23
regenerate doc
jpfinne Sep 29, 2026
8c66666
regenerate doc
jpfinne Sep 29, 2026
ca1e747
Rollback invalid commit
jpfinne Sep 29, 2026
613a08e
Fix jakarta.validation.constraint.NotNull
jpfinne Sep 29, 2026
db7f7a3
Do not remove the @NotNull annotation if it was explicity provided
jpfinne Sep 30, 2026
a071e38
Rename tests
jpfinne Oct 2, 2026
ce57919
Normalizer: x-items-xxx
jpfinne Oct 2, 2026
f6902a2
Merge remote-tracking branch 'upstream/master' into x-items-x-field-e…
jpfinne Oct 4, 2026
a62236e
Ensure @Valid generated for items: allOf: [$ref]
jpfinne Oct 4, 2026
2e5d0e8
Test for inline ref
jpfinne Oct 4, 2026
86be7e8
Test for inline ref
jpfinne Oct 4, 2026
9d26d68
Merge branch 'OpenAPITools:master' into master
jpfinne Oct 4, 2026
ce48b02
merge remote
jpfinne Oct 4, 2026
90116a5
Merge branch 'master' of https://github.com/jpfinne/openapi-generator
jpfinne Oct 4, 2026
ed4bc34
Merge branch 'master' into x-items-x-field-extra-annotation
jpfinne Oct 4, 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 @@ -1141,9 +1141,39 @@ protected void markSchemaAsVisited(Schema schema, Set<Schema> visitedSchemas) {

protected Schema normalizeArraySchema(Schema schema) {
Schema result = processNormalize31Spec(schema, new HashSet<>());

processExtensionsInRefItems(result);
return processSetArraytoNullable(result);
}

/**
* Move the extensions starting with x-items to the items.extensions.
*
* @param schema the array schema to process
*/
protected void processExtensionsInRefItems(Schema schema) {
if (schema == null || schema.getItems() == null) {
return;
}

Map<String, Object> extensions = schema.getExtensions();
if (extensions != null) {
Map<String, Object> itemsExtensions = schema.getItems().getExtensions();
for (Iterator<String> it = extensions.keySet().iterator(); it.hasNext(); ) {
String key = it.next();
if (key.startsWith("x-items-")) {
if (itemsExtensions == null) {
itemsExtensions = new LinkedHashMap<>();
schema.getItems().setExtensions(itemsExtensions);
}
String newKey = key.substring("x-items-".length());
itemsExtensions.put(newKey, extensions.get(key));
it.remove();
}
}
}
}

protected Schema normalizeMapSchema(Schema schema) {
Schema result = processNormalize31Spec(schema, new HashSet<>());
return processSetMapToNullable(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1248,9 +1248,15 @@ protected String getBeanValidation(Schema<?> items) {
return "";
}

if (items.get$ref() != null) {
String itemsRef = items.get$ref();
if (itemsRef == null && items.getAllOf() != null && items.getAllOf().size() == 1) {
// $ref with siblings is wrapped by the normalizer into allOf: [$ref]
// -> ensure that @Valid is used below
itemsRef = items.getAllOf().get(0).get$ref();
}
if (itemsRef != null) {
Map<String, Schema> schemas = this.openAPI.getComponents().getSchemas();
String ref = ModelUtils.getSimpleRef(items.get$ref());
String ref = ModelUtils.getSimpleRef(itemsRef);
if (ref != null) {
Schema<?> schema = schemas.get(ref);
// objects and oneOf/anyOf/allOf models cascade validation into their elements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10185,7 +10185,9 @@ void listItems_annotated_with_x_field_extra_annotation() throws IOException {
.fileContains(
"private List<@NotNull @Size(max=50) String> listString",
"private List<@Min(0)Integer> listInteger",
"private List<@Size(max=10) String> listCode"
"private List<@Size(max=10) String> listCode",
"private List<@NotEmpty @Valid Stubb> listRef",
"private List<@NotEmpty @Valid SampleModelListInlineInner>"
);
}

Expand All @@ -10201,6 +10203,8 @@ void listItems_with_additionalItemsAnnotations() throws IOException {
"private List<@Size(max=50) String> listStringNullable",
"private List<@NotNull @Valid Stubb> listSample",
"private List<@NotNull @Min(0)Integer> listInteger",
"private List<@NotNull @Size(max=10) String> listCode");
"private List<@NotNull @Size(max=10) String> listCode",
"private List<@NotNull @NotEmpty @Valid Stubb> listRef",
"private List<@NotNull @NotEmpty @Valid SampleModelListInlineInner>");
}
}
13 changes: 13 additions & 0 deletions modules/openapi-generator/src/test/resources/3_0/issue_23705.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,17 @@ components:
allOf:
- $ref: '#/components/schemas/Code'
x-field-extra-annotation: '@Size(max=10)'
listRef:
type: array
x-items-x-field-extra-annotation: '@NotEmpty'
items:
$ref: '#/components/schemas/Stubb'
listInline:
type: array
x-items-x-field-extra-annotation: '@NotEmpty'
items:
type: object
properties:
name:
type: string

Loading