Skip to content

Commit

Permalink
refs #4610 - deprecate and fix ArraySchema.items processing (switch t…
Browse files Browse the repository at this point in the history
…o ArraySchema.schema)
  • Loading branch information
frantuma committed Feb 5, 2024
1 parent 0d067d0 commit 78a11e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
*
* @since 2.2.12
*
* @deprecated since 2.2.21, use {@link #schema()} instead. Marked for removal in future versions.
* @return items
*/

@Deprecated
Schema items() default @Schema;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2936,11 +2936,17 @@ private void resolveArraySchema(AnnotatedType annotatedType, ArraySchema schema,
schema.addPrefixItem(prefixItem);
}
}
// TODO `ArraySchema.items` is deprecated, when removed, remove this block
if (schema.getItems() != null && AnnotationsUtils.hasSchemaAnnotation(resolvedArrayAnnotation.items())) {
for (String type : resolvedArrayAnnotation.items().types()) {
schema.getItems().addType(type);
}
}
if (schema.getItems() != null && AnnotationsUtils.hasSchemaAnnotation(resolvedArrayAnnotation.schema())) {
for (String type : resolvedArrayAnnotation.schema().types()) {
schema.getItems().addType(type);
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
unevaluatedItems = @Schema(
types = { "number" }
),
items = @Schema(
schema = @Schema(
types = { "string" }
),
prefixItems = {
Expand Down

0 comments on commit 78a11e9

Please sign in to comment.