diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/NullableTest.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/NullableTest.java index 682796b26..4cc06489e 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/NullableTest.java +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/NullableTest.java @@ -5,6 +5,7 @@ import com.vaadin.hilla.parser.plugins.nonnull.AnnotationMatcher; import com.vaadin.hilla.parser.plugins.nonnull.NonnullPlugin; import com.vaadin.hilla.parser.plugins.nonnull.NonnullPluginConfig; +import com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi.NullableNonNullEndpoint; import com.vaadin.hilla.parser.plugins.nonnull.test.helpers.TestHelper; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/NullableNonNullEndpoint.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/NullableNonNullEndpoint.java new file mode 100644 index 000000000..da2efdb06 --- /dev/null +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/NullableNonNullEndpoint.java @@ -0,0 +1,25 @@ +package com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi; + +import com.vaadin.hilla.parser.plugins.nonnull.nullable.Endpoint; +import jakarta.annotation.Nonnull; +import jakarta.persistence.Id; +import jakarta.persistence.Version; + +@Endpoint +public class NullableNonNullEndpoint { + + public NullableNonNullFieldModel nullableNonNullFieldModel(NullableNonNullFieldModel nullableNonNullFieldModel) { + return nullableNonNullFieldModel; + } + + public static class NullableNonNullFieldModel { + public String required; + @Id + public String id; + @Version + public Long version; + @Version + @Nonnull + public Long notNullVersion; + } +} diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/package-info.java b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/package-info.java new file mode 100644 index 000000000..1f8562e6e --- /dev/null +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/java/com/vaadin/hilla/parser/plugins/nonnull/nullable/nonNullApi/package-info.java @@ -0,0 +1,4 @@ +@NonNullApi +package com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi; + +import org.springframework.lang.NonNullApi; diff --git a/packages/java/parser-jvm-plugin-nonnull/src/test/resources/com/vaadin/hilla/parser/plugins/nonnull/nullable/openapi.json b/packages/java/parser-jvm-plugin-nonnull/src/test/resources/com/vaadin/hilla/parser/plugins/nonnull/nullable/openapi.json index 5b4a0ef83..07336d76d 100644 --- a/packages/java/parser-jvm-plugin-nonnull/src/test/resources/com/vaadin/hilla/parser/plugins/nonnull/nullable/openapi.json +++ b/packages/java/parser-jvm-plugin-nonnull/src/test/resources/com/vaadin/hilla/parser/plugins/nonnull/nullable/openapi.json @@ -14,6 +14,10 @@ { "name" : "NullableEndpoint", "x-class-name" : "com.vaadin.hilla.parser.plugins.nonnull.nullable.NullableEndpoint" + }, + { + "name" : "NullableNonNullEndpoint", + "x-class-name" : "com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi.NullableNonNullEndpoint" } ], "paths" : { @@ -60,6 +64,48 @@ } } } + }, + "/NullableNonNullEndpoint/nullableNonNullFieldModel" : { + "post" : { + "tags" : [ + "NullableNonNullEndpoint" + ], + "operationId" : "NullableNonNullEndpoint_nullableNonNullFieldModel_POST", + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "type" : "object", + "properties" : { + "nullableNonNullFieldModel" : { + "anyOf" : [ + { + "$ref" : "#/components/schemas/com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi.NullableNonNullEndpoint$NullableNonNullFieldModel" + } + ] + } + } + } + } + } + }, + "responses" : { + "200" : { + "description" : "", + "content" : { + "application/json" : { + "schema" : { + "anyOf" : [ + { + "$ref" : "#/components/schemas/com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi.NullableNonNullEndpoint$NullableNonNullFieldModel" + } + ] + } + } + } + } + } + } } }, "components" : { @@ -77,6 +123,27 @@ "nullable" : true } } + }, + "com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi.NullableNonNullEndpoint$NullableNonNullFieldModel" : { + "type" : "object", + "properties" : { + "required" : { + "type" : "string" + }, + "id" : { + "type" : "string", + "nullable" : true + }, + "version" : { + "type" : "integer", + "format" : "int64", + "nullable" : true + }, + "notNullVersion" : { + "type" : "integer", + "format" : "int64" + } + } } } }