[OpenAPI 3.1] Avoid NPE when handling prefixItems (#19735)

* avoid npe when handling prefixItems in 3.1 spec

* update samples
This commit is contained in:
William Cheng
2024-10-01 17:36:11 +08:00
committed by GitHub
parent 60d0888898
commit d7ac1e4337
7 changed files with 44 additions and 22 deletions

View File

@@ -63,7 +63,7 @@ public class AnyTypeTest {
public static final String SERIALIZED_NAME_REF_ARRAY_PREFIX_ITEMS = "ref_array_prefix_items";
@SerializedName(SERIALIZED_NAME_REF_ARRAY_PREFIX_ITEMS)
private List<String> refArrayPrefixItems = new ArrayList<>();
private List<Object> refArrayPrefixItems = new ArrayList<>();
public AnyTypeTest() {
}
@@ -114,12 +114,12 @@ public class AnyTypeTest {
}
public AnyTypeTest refArrayPrefixItems(List<String> refArrayPrefixItems) {
public AnyTypeTest refArrayPrefixItems(List<Object> refArrayPrefixItems) {
this.refArrayPrefixItems = refArrayPrefixItems;
return this;
}
public AnyTypeTest addRefArrayPrefixItemsItem(String refArrayPrefixItemsItem) {
public AnyTypeTest addRefArrayPrefixItemsItem(Object refArrayPrefixItemsItem) {
if (this.refArrayPrefixItems == null) {
this.refArrayPrefixItems = new ArrayList<>();
}
@@ -132,11 +132,11 @@ public class AnyTypeTest {
* @return refArrayPrefixItems
*/
@javax.annotation.Nullable
public List<String> getRefArrayPrefixItems() {
public List<Object> getRefArrayPrefixItems() {
return refArrayPrefixItems;
}
public void setRefArrayPrefixItems(List<String> refArrayPrefixItems) {
public void setRefArrayPrefixItems(List<Object> refArrayPrefixItems) {
this.refArrayPrefixItems = refArrayPrefixItems;
}