diff --git a/fusion-endpoint/pom.xml b/fusion-endpoint/pom.xml
index 71fe5b6e938..58378a6e9bb 100644
--- a/fusion-endpoint/pom.xml
+++ b/fusion-endpoint/pom.xml
@@ -17,7 +17,7 @@
5.3.0
2.2.0.RELEASE
1.3.2
- 3.15.1
+ 3.23.0
3.0.2
1.0.2
diff --git a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/OpenAPIObjectGenerator.java b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/OpenAPIObjectGenerator.java
index 42d9cc351bb..4d14aedc6ba 100644
--- a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/OpenAPIObjectGenerator.java
+++ b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/OpenAPIObjectGenerator.java
@@ -811,7 +811,8 @@ private List parseReferencedTypeAsSchema(GeneratorType type) {
List directAncestors = resolvedReferenceType
.getDirectAncestors().stream()
- .filter(parent -> parent.getTypeDeclaration().isClass()
+ .filter(parent -> parent.getTypeDeclaration()
+ .orElseThrow(IllegalArgumentException::new).isClass()
&& !Object.class.getName()
.equals(parent.getQualifiedName()))
.collect(Collectors.toList());
@@ -864,7 +865,8 @@ private List generatedRelatedSchemas(Schema schema) {
*/
private String getFullyQualifiedName(GeneratorType type) {
ResolvedReferenceTypeDeclaration typeDeclaration = type.asResolvedType()
- .asReferenceType().getTypeDeclaration();
+ .asReferenceType().getTypeDeclaration()
+ .orElseThrow(IllegalArgumentException::new);
String packageName = typeDeclaration.getPackageName();
String canonicalName = typeDeclaration.getQualifiedName();
if (GeneratorUtils.isBlank(packageName)) {
diff --git a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaGenerator.java b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaGenerator.java
index f605b664d27..84f0208d8ce 100644
--- a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaGenerator.java
+++ b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaGenerator.java
@@ -35,6 +35,7 @@
import com.github.javaparser.ast.type.Type;
import com.github.javaparser.resolution.declarations.ResolvedEnumConstantDeclaration;
import com.github.javaparser.resolution.declarations.ResolvedFieldDeclaration;
+import com.github.javaparser.resolution.declarations.ResolvedReferenceTypeDeclaration;
import com.github.javaparser.resolution.types.ResolvedReferenceType;
import com.github.javaparser.resolution.types.ResolvedType;
@@ -115,7 +116,8 @@ Schema createSingleSchemaFromResolvedType(GeneratorType type) {
if (type.isEnum()) {
List entries = resolvedReferenceType.getTypeDeclaration()
- .asEnum().getEnumConstants().stream()
+ .orElseThrow(IllegalArgumentException::new).asEnum()
+ .getEnumConstants().stream()
.map(ResolvedEnumConstantDeclaration::getName)
.collect(Collectors.toList());
StringSchema schema = new StringSchema();
@@ -127,7 +129,8 @@ Schema createSingleSchemaFromResolvedType(GeneratorType type) {
.name(resolvedReferenceType.getQualifiedName());
Map fieldsOptionalMap = getFieldsAndOptionalMap(type);
List serializableFields = resolvedReferenceType
- .getTypeDeclaration().getDeclaredFields().stream()
+ .getTypeDeclaration().orElseThrow(IllegalArgumentException::new)
+ .getDeclaredFields().stream()
.filter(resolvedFieldDeclaration -> fieldsOptionalMap
.containsKey(resolvedFieldDeclaration.getName()))
.collect(Collectors.toList());
@@ -167,9 +170,11 @@ private Map getFieldsAndOptionalMap(GeneratorType type) {
ResolvedReferenceType resolvedReferenceType = type.asResolvedType()
.asReferenceType();
- if (!resolvedReferenceType.getTypeDeclaration().isClass()
- || resolvedReferenceType.getTypeDeclaration()
- .isAnonymousClass()) {
+ Optional typeDeclaration = resolvedReferenceType
+ .getTypeDeclaration();
+ if (!typeDeclaration
+ .filter(td -> td.isClass() && !td.isAnonymousClass())
+ .isPresent()) {
return Collections.emptyMap();
}
HashMap validFields = new HashMap<>();
diff --git a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaResolver.java b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaResolver.java
index f95be9f0a42..919a6736373 100644
--- a/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaResolver.java
+++ b/fusion-endpoint/src/main/java/com/vaadin/fusion/generator/SchemaResolver.java
@@ -187,7 +187,8 @@ private Schema createEnumTypeSchema() {
ResolvedReferenceType resolvedReferenceType = type.asResolvedType()
.asReferenceType();
List entries = resolvedReferenceType.getTypeDeclaration()
- .asEnum().getEnumConstants().stream()
+ .orElseThrow(IllegalArgumentException::new).asEnum()
+ .getEnumConstants().stream()
.map(ResolvedEnumConstantDeclaration::getName)
.collect(Collectors.toList());
String qualifiedName = resolvedReferenceType.getQualifiedName();