Skip to content

Commit

Permalink
Add test for nonnull and nullable hierarchy
Browse files Browse the repository at this point in the history
Fixes: #2833
  • Loading branch information
krissvaa committed Oct 25, 2024
1 parent 3667a6c commit ea51469
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@NonNullApi
package com.vaadin.hilla.parser.plugins.nonnull.nullable.nonNullApi;

import org.springframework.lang.NonNullApi;
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down Expand Up @@ -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" : {
Expand All @@ -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"
}
}
}
}
}
Expand Down

0 comments on commit ea51469

Please sign in to comment.