Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions spring-ai-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;

Expand Down Expand Up @@ -213,8 +214,9 @@ private static boolean isMethodParameterRequired(Method method, int index) {
|| schemaAnnotation.requiredMode() == Schema.RequiredMode.AUTO || schemaAnnotation.required();
}

var nullableAnnotation = parameter.getAnnotation(Nullable.class);
if (nullableAnnotation != null) {
var nullableAnnotationPresent = Arrays.stream(parameter.getAnnotations())
.anyMatch(ann -> ann.annotationType().getSimpleName().equals("Nullable"));
if (nullableAnnotationPresent) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.springframework.ai.util.json.schema;

import java.lang.annotation.Annotation;
import java.util.stream.Stream;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -104,7 +105,8 @@ private boolean checkRequired(MemberScope<?, ?> member) {
|| schemaAnnotation.requiredMode() == Schema.RequiredMode.AUTO || schemaAnnotation.required();
}

var nullableAnnotation = member.getAnnotationConsideringFieldAndGetter(Nullable.class);
var nullableAnnotation = member.getAnnotationConsideringFieldAndGetter(Annotation.class,
ann -> ann.annotationType().getSimpleName().equals("Nullable"));
if (nullableAnnotation != null) {
return false;
}
Expand Down
Loading