Skip to content

Commit

Permalink
Remove APIs deprecated in 1.0.x
Browse files Browse the repository at this point in the history
Closes gh-941
  • Loading branch information
bclozel committed Mar 30, 2024
1 parent 8a4a432 commit 3e898f7
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 295 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,21 +31,6 @@
*/
public interface ResponseField {

/**
* Whether the field has a value.
* <ul>
* <li>{@code "true"} means the field is not {@code null}, and therefore valid,
* although it may be partial with nested field {@link #getErrors() errors}.
* <li>{@code "false"} means the field is {@code null} or doesn't exist; use
* {@link #getErrors()} to check for field errors, and
* {@link GraphQlResponse#isValid()} to check if the entire response is
* valid or not.
* </ul>
* @deprecated as of 1.0.3 in favor of checking via {@link #getValue()}
*/
@Deprecated
boolean hasValue();

/**
* Return a String representation of the field path as described in
* {@link ClientGraphQlResponse#field(String)}.
Expand All @@ -67,32 +52,6 @@ public interface ResponseField {
@Nullable
<T> T getValue();

/**
* Return the error that provides the reason for a failed field.
* <p>When the field is {@code null}, this method looks for the first field
* error. According to the GraphQL spec, section 6.4.4, "Handling Field
* Errors", there should be only one error per field. The returned field
* error may be:
* <ul>
* <li>on the field
* <li>on a parent field, when the field is not present
* <li>on a nested field, when a {@code non-null} nested field error bubbles up
* </ul>
* <p>As a fallback, this method also checks "request errors" in case the
* entire response is not {@link GraphQlResponse#isValid() valid}. If there
* are no errors at all, {@code null} is returned, and it implies the field
* value was set to {@code null} by its {@code DataFetcher}.
* <p>When the field <strong>does</strong> have a value, it is considered
* valid and this method returns {@code null}, although the field may be
* partial and contain {@link #getErrors() errors} on nested fields.
* @return return the error for this field, or {@code null} if there is no
* error with the same path as the field path
* @deprecated since 1.0.3 in favor of {@link #getErrors()}
*/
@Nullable
@Deprecated
ResponseError getError();

/**
* Return all errors that have a path, and it is at above, or below the field path.
* <p>According to the GraphQL spec, section 6.4.4, "Handling Field Errors"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,12 +55,6 @@ final class DefaultClientResponseField implements ClientResponseField {
}


@SuppressWarnings("deprecation")
@Override
public boolean hasValue() {
return (this.field.getValue() != null);
}

@Override
public String getPath() {
return this.field.getPath();
Expand All @@ -76,12 +70,6 @@ public <T> T getValue() {
return this.field.getValue();
}

@SuppressWarnings("deprecation")
@Override
public ResponseError getError() {
return this.field.getError();
}

@Override
public List<ResponseError> getErrors() {
return this.field.getErrors();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.DataFetchingFieldSelectionSet;
import graphql.schema.GraphQLArgument;
import graphql.schema.GraphQLTypeVisitor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -295,45 +294,6 @@ public DataFetcher<?> scrollable() {
return new AutoRegistrationRuntimeWiringConfigurer(factories);
}

/**
* Create a {@link GraphQLTypeVisitor} that finds queries with a return type
* whose name matches to the domain type name of the given repositories and
* registers {@link DataFetcher}s for those queries.
* <p><strong>Note:</strong> currently, this method will match only to
* queries under the top-level "Query" type in the GraphQL schema.
*
* @param executors repositories to consider for registration
* @param reactiveExecutors reactive repositories to consider for registration
* @return the created visitor
* @deprecated in favor of {@link #autoRegistrationConfigurer(List, List)}
*/
@Deprecated
public static GraphQLTypeVisitor autoRegistrationTypeVisitor(
List<QueryByExampleExecutor<?>> executors,
List<ReactiveQueryByExampleExecutor<?>> reactiveExecutors) {

Map<String, Function<Boolean, DataFetcher<?>>> factories = new HashMap<>();

for (QueryByExampleExecutor<?> executor : executors) {
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
if (typeName != null) {
Builder<?, ?> builder = customize(executor, builder(executor));
factories.put(typeName, single -> single ? builder.single() : builder.many());
}
}

for (ReactiveQueryByExampleExecutor<?> executor : reactiveExecutors) {
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
if (typeName != null) {
ReactiveBuilder<?, ?> builder = customize(executor, builder(executor));
factories.put(typeName, single -> single ? builder.single() : builder.many());
}
}

return new AutoRegistrationTypeVisitor(factories);
}


@SuppressWarnings({"unchecked", "rawtypes"})
private static Builder customize(QueryByExampleExecutor<?> executor, Builder builder) {
if(executor instanceof QueryByExampleBuilderCustomizer<?> customizer){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import graphql.schema.DataFetcher;
import graphql.schema.DataFetchingEnvironment;
import graphql.schema.DataFetchingFieldSelectionSet;
import graphql.schema.GraphQLTypeVisitor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Flux;
Expand Down Expand Up @@ -326,50 +325,6 @@ public DataFetcher<?> scrollable() {
return new AutoRegistrationRuntimeWiringConfigurer(factories);
}

/**
* Return a {@link GraphQLTypeVisitor} that auto-registers the given
* Querydsl repositories for queries that do not already have a registered
* {@code DataFetcher} and whose return type matches the simple name of the
* repository domain type.
*
* <p><strong>Note:</strong> Auto-registration applies only to
* {@link GraphQlRepository @GraphQlRepository}-annotated repositories.
* If a repository is also an instance of {@link QuerydslBinderCustomizer},
* this is transparently detected and applied through the
* {@code QuerydslDataFetcher} builder methods.
*
* @param executors repositories to consider for registration
* @param reactiveExecutors reactive repositories to consider for registration
* @return the created visitor
* @deprecated in favor of {@link #autoRegistrationConfigurer(List, List)}
*/
@SuppressWarnings({"unchecked", "rawtypes"})
@Deprecated
public static GraphQLTypeVisitor autoRegistrationTypeVisitor(
List<QuerydslPredicateExecutor<?>> executors,
List<ReactiveQuerydslPredicateExecutor<?>> reactiveExecutors) {

Map<String, Function<Boolean, DataFetcher<?>>> factories = new HashMap<>();

for (QuerydslPredicateExecutor<?> executor : executors) {
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
if (typeName != null) {
Builder<?, ?> builder = customize(executor, QuerydslDataFetcher.builder(executor).customizer(customizer(executor)));
factories.put(typeName, single -> single ? builder.single() : builder.many());
}
}

for (ReactiveQuerydslPredicateExecutor<?> executor : reactiveExecutors) {
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
if (typeName != null) {
ReactiveBuilder builder = customize(executor, QuerydslDataFetcher.builder(executor).customizer(customizer(executor)));
factories.put(typeName, single -> single ? builder.single() : builder.many());
}
}

return new AutoRegistrationTypeVisitor(factories);
}

@SuppressWarnings({"unchecked", "rawtypes"})
private static Builder customize(QuerydslPredicateExecutor<?> executor, Builder builder) {
if(executor instanceof QuerydslBuilderCustomizer<?> customizer){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,4 @@ protected GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironmen
}


/**
* Factory method to create a {@link DataFetcherExceptionResolverAdapter} that
* resolves exceptions with the given {@code BiFunction}.
* @param resolver the resolver function to use
* @return the created instance
* @deprecated as of 1.0.1, please use {@link DataFetcherExceptionResolver#forSingleError(BiFunction)}
*/
@Deprecated
public static DataFetcherExceptionResolverAdapter from(
BiFunction<Throwable, DataFetchingEnvironment, GraphQLError> resolver) {

return new DataFetcherExceptionResolverAdapter() {

@Override
protected GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironment env) {
return resolver.apply(ex, env);
}
};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class WebSocketGraphQlRequest extends WebGraphQlRequest {
* Create an instance.
* @deprecated as of 1.1.3 in favor of the constructor with cookies
*/
@Deprecated
@Deprecated(since = "1.1.3", forRemoval = true)
public WebSocketGraphQlRequest(
URI uri, HttpHeaders headers, Map<String, Object> body, String id, @Nullable Locale locale,
WebSocketSessionInfo sessionInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public WebSocketHttpRequestHandler initWebSocketHttpRequestHandler(HandshakeHand
* propagate context.
* @deprecated as of 1.1.0 in favor of {@link #initWebSocketHttpRequestHandler(HandshakeHandler)}
*/
@Deprecated
@Deprecated(since = "1.1.0", forRemoval = true)
public WebSocketHttpRequestHandler asWebSocketHttpRequestHandler(HandshakeHandler handshakeHandler) {
return initWebSocketHttpRequestHandler(handshakeHandler);
}
Expand Down
Loading

0 comments on commit 3e898f7

Please sign in to comment.