diff --git a/common/schema-builder/src/main/java/io/smallrye/graphql/schema/helper/NonNullHelper.java b/common/schema-builder/src/main/java/io/smallrye/graphql/schema/helper/NonNullHelper.java index b79eb1fd1..fe9939ca7 100644 --- a/common/schema-builder/src/main/java/io/smallrye/graphql/schema/helper/NonNullHelper.java +++ b/common/schema-builder/src/main/java/io/smallrye/graphql/schema/helper/NonNullHelper.java @@ -5,6 +5,7 @@ import io.smallrye.graphql.schema.Annotations; import io.smallrye.graphql.schema.Classes; +import io.smallrye.graphql.schema.SchemaBuilderException; /** * Helping to figure out of some should be marked as Non null @@ -55,7 +56,7 @@ public static boolean markAsNonNull(Type type, Annotations annotations, boolean boolean hasDefaultValue = hasDefaultValue(annotations); if (hasDefaultValue) { if (hasNonNull && !type.kind().equals(Type.Kind.PRIMITIVE)) { - LOG.warn("Ignoring non null on [" + type.name() + "] as there is a @DefaultValue"); + throw new SchemaBuilderException("You can't have both @NonNull and @DefaultValue on [" + type.name() + "]"); } return false; }