Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw an error when both DefaultValue and NonNull are present #2185

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
cd quarkus && \
./mvnw install -Dsmallrye-graphql.version=$SMALLRYE_VERSION -Dquickly && \
./mvnw verify -Dsmallrye-graphql.version=$SMALLRYE_VERSION -Dnative \
-pl extensions/smallrye-graphql-client/deployment,extensions/smallrye-graphql-client/runtime,extensions/smallrye-graphql/deployment,extensions/smallrye-graphql/runtime,integration-tests/smallrye-graphql,integration-tests/smallrye-graphql-client,integration-tests/hibernate-orm-graphql-panache,extensions/oidc-client-graphql/deployment,extensions/oidc-client-graphql/runtime,tcks/microprofile-graphql -Ptcks
-pl extensions/smallrye-graphql-client/deployment,extensions/smallrye-graphql-client/runtime,extensions/smallrye-graphql/deployment,extensions/smallrye-graphql/runtime,integration-tests/smallrye-graphql,integration-tests/smallrye-graphql-client,integration-tests/hibernate-orm-graphql-panache,extensions/oidc-client-graphql/deployment,extensions/oidc-client-graphql/runtime,tcks/microprofile-graphql,integration-tests/devtools -Ptcks

quality:
needs: [build]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
Loading