Skip to content

Commit 3e898f7

Browse files
committed
Remove APIs deprecated in 1.0.x
Closes gh-941
1 parent 8a4a432 commit 3e898f7

9 files changed

+5
-295
lines changed

spring-graphql/src/main/java/org/springframework/graphql/ResponseField.java

+1-42
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,21 +31,6 @@
3131
*/
3232
public interface ResponseField {
3333

34-
/**
35-
* Whether the field has a value.
36-
* <ul>
37-
* <li>{@code "true"} means the field is not {@code null}, and therefore valid,
38-
* although it may be partial with nested field {@link #getErrors() errors}.
39-
* <li>{@code "false"} means the field is {@code null} or doesn't exist; use
40-
* {@link #getErrors()} to check for field errors, and
41-
* {@link GraphQlResponse#isValid()} to check if the entire response is
42-
* valid or not.
43-
* </ul>
44-
* @deprecated as of 1.0.3 in favor of checking via {@link #getValue()}
45-
*/
46-
@Deprecated
47-
boolean hasValue();
48-
4934
/**
5035
* Return a String representation of the field path as described in
5136
* {@link ClientGraphQlResponse#field(String)}.
@@ -67,32 +52,6 @@ public interface ResponseField {
6752
@Nullable
6853
<T> T getValue();
6954

70-
/**
71-
* Return the error that provides the reason for a failed field.
72-
* <p>When the field is {@code null}, this method looks for the first field
73-
* error. According to the GraphQL spec, section 6.4.4, "Handling Field
74-
* Errors", there should be only one error per field. The returned field
75-
* error may be:
76-
* <ul>
77-
* <li>on the field
78-
* <li>on a parent field, when the field is not present
79-
* <li>on a nested field, when a {@code non-null} nested field error bubbles up
80-
* </ul>
81-
* <p>As a fallback, this method also checks "request errors" in case the
82-
* entire response is not {@link GraphQlResponse#isValid() valid}. If there
83-
* are no errors at all, {@code null} is returned, and it implies the field
84-
* value was set to {@code null} by its {@code DataFetcher}.
85-
* <p>When the field <strong>does</strong> have a value, it is considered
86-
* valid and this method returns {@code null}, although the field may be
87-
* partial and contain {@link #getErrors() errors} on nested fields.
88-
* @return return the error for this field, or {@code null} if there is no
89-
* error with the same path as the field path
90-
* @deprecated since 1.0.3 in favor of {@link #getErrors()}
91-
*/
92-
@Nullable
93-
@Deprecated
94-
ResponseError getError();
95-
9655
/**
9756
* Return all errors that have a path, and it is at above, or below the field path.
9857
* <p>According to the GraphQL spec, section 6.4.4, "Handling Field Errors"

spring-graphql/src/main/java/org/springframework/graphql/client/DefaultClientResponseField.java

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -55,12 +55,6 @@ final class DefaultClientResponseField implements ClientResponseField {
5555
}
5656

5757

58-
@SuppressWarnings("deprecation")
59-
@Override
60-
public boolean hasValue() {
61-
return (this.field.getValue() != null);
62-
}
63-
6458
@Override
6559
public String getPath() {
6660
return this.field.getPath();
@@ -76,12 +70,6 @@ public <T> T getValue() {
7670
return this.field.getValue();
7771
}
7872

79-
@SuppressWarnings("deprecation")
80-
@Override
81-
public ResponseError getError() {
82-
return this.field.getError();
83-
}
84-
8573
@Override
8674
public List<ResponseError> getErrors() {
8775
return this.field.getErrors();

spring-graphql/src/main/java/org/springframework/graphql/data/query/AutoRegistrationTypeVisitor.java

-111
This file was deleted.

spring-graphql/src/main/java/org/springframework/graphql/data/query/QueryByExampleDataFetcher.java

-40
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import graphql.schema.DataFetchingEnvironment;
2828
import graphql.schema.DataFetchingFieldSelectionSet;
2929
import graphql.schema.GraphQLArgument;
30-
import graphql.schema.GraphQLTypeVisitor;
3130
import org.apache.commons.logging.Log;
3231
import org.apache.commons.logging.LogFactory;
3332
import reactor.core.publisher.Flux;
@@ -295,45 +294,6 @@ public DataFetcher<?> scrollable() {
295294
return new AutoRegistrationRuntimeWiringConfigurer(factories);
296295
}
297296

298-
/**
299-
* Create a {@link GraphQLTypeVisitor} that finds queries with a return type
300-
* whose name matches to the domain type name of the given repositories and
301-
* registers {@link DataFetcher}s for those queries.
302-
* <p><strong>Note:</strong> currently, this method will match only to
303-
* queries under the top-level "Query" type in the GraphQL schema.
304-
*
305-
* @param executors repositories to consider for registration
306-
* @param reactiveExecutors reactive repositories to consider for registration
307-
* @return the created visitor
308-
* @deprecated in favor of {@link #autoRegistrationConfigurer(List, List)}
309-
*/
310-
@Deprecated
311-
public static GraphQLTypeVisitor autoRegistrationTypeVisitor(
312-
List<QueryByExampleExecutor<?>> executors,
313-
List<ReactiveQueryByExampleExecutor<?>> reactiveExecutors) {
314-
315-
Map<String, Function<Boolean, DataFetcher<?>>> factories = new HashMap<>();
316-
317-
for (QueryByExampleExecutor<?> executor : executors) {
318-
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
319-
if (typeName != null) {
320-
Builder<?, ?> builder = customize(executor, builder(executor));
321-
factories.put(typeName, single -> single ? builder.single() : builder.many());
322-
}
323-
}
324-
325-
for (ReactiveQueryByExampleExecutor<?> executor : reactiveExecutors) {
326-
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
327-
if (typeName != null) {
328-
ReactiveBuilder<?, ?> builder = customize(executor, builder(executor));
329-
factories.put(typeName, single -> single ? builder.single() : builder.many());
330-
}
331-
}
332-
333-
return new AutoRegistrationTypeVisitor(factories);
334-
}
335-
336-
337297
@SuppressWarnings({"unchecked", "rawtypes"})
338298
private static Builder customize(QueryByExampleExecutor<?> executor, Builder builder) {
339299
if(executor instanceof QueryByExampleBuilderCustomizer<?> customizer){

spring-graphql/src/main/java/org/springframework/graphql/data/query/QuerydslDataFetcher.java

-45
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import graphql.schema.DataFetcher;
2929
import graphql.schema.DataFetchingEnvironment;
3030
import graphql.schema.DataFetchingFieldSelectionSet;
31-
import graphql.schema.GraphQLTypeVisitor;
3231
import org.apache.commons.logging.Log;
3332
import org.apache.commons.logging.LogFactory;
3433
import reactor.core.publisher.Flux;
@@ -326,50 +325,6 @@ public DataFetcher<?> scrollable() {
326325
return new AutoRegistrationRuntimeWiringConfigurer(factories);
327326
}
328327

329-
/**
330-
* Return a {@link GraphQLTypeVisitor} that auto-registers the given
331-
* Querydsl repositories for queries that do not already have a registered
332-
* {@code DataFetcher} and whose return type matches the simple name of the
333-
* repository domain type.
334-
*
335-
* <p><strong>Note:</strong> Auto-registration applies only to
336-
* {@link GraphQlRepository @GraphQlRepository}-annotated repositories.
337-
* If a repository is also an instance of {@link QuerydslBinderCustomizer},
338-
* this is transparently detected and applied through the
339-
* {@code QuerydslDataFetcher} builder methods.
340-
*
341-
* @param executors repositories to consider for registration
342-
* @param reactiveExecutors reactive repositories to consider for registration
343-
* @return the created visitor
344-
* @deprecated in favor of {@link #autoRegistrationConfigurer(List, List)}
345-
*/
346-
@SuppressWarnings({"unchecked", "rawtypes"})
347-
@Deprecated
348-
public static GraphQLTypeVisitor autoRegistrationTypeVisitor(
349-
List<QuerydslPredicateExecutor<?>> executors,
350-
List<ReactiveQuerydslPredicateExecutor<?>> reactiveExecutors) {
351-
352-
Map<String, Function<Boolean, DataFetcher<?>>> factories = new HashMap<>();
353-
354-
for (QuerydslPredicateExecutor<?> executor : executors) {
355-
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
356-
if (typeName != null) {
357-
Builder<?, ?> builder = customize(executor, QuerydslDataFetcher.builder(executor).customizer(customizer(executor)));
358-
factories.put(typeName, single -> single ? builder.single() : builder.many());
359-
}
360-
}
361-
362-
for (ReactiveQuerydslPredicateExecutor<?> executor : reactiveExecutors) {
363-
String typeName = RepositoryUtils.getGraphQlTypeName(executor);
364-
if (typeName != null) {
365-
ReactiveBuilder builder = customize(executor, QuerydslDataFetcher.builder(executor).customizer(customizer(executor)));
366-
factories.put(typeName, single -> single ? builder.single() : builder.many());
367-
}
368-
}
369-
370-
return new AutoRegistrationTypeVisitor(factories);
371-
}
372-
373328
@SuppressWarnings({"unchecked", "rawtypes"})
374329
private static Builder customize(QuerydslPredicateExecutor<?> executor, Builder builder) {
375330
if(executor instanceof QuerydslBuilderCustomizer<?> customizer){

spring-graphql/src/main/java/org/springframework/graphql/execution/DataFetcherExceptionResolverAdapter.java

-20
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,4 @@ protected GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironmen
134134
}
135135

136136

137-
/**
138-
* Factory method to create a {@link DataFetcherExceptionResolverAdapter} that
139-
* resolves exceptions with the given {@code BiFunction}.
140-
* @param resolver the resolver function to use
141-
* @return the created instance
142-
* @deprecated as of 1.0.1, please use {@link DataFetcherExceptionResolver#forSingleError(BiFunction)}
143-
*/
144-
@Deprecated
145-
public static DataFetcherExceptionResolverAdapter from(
146-
BiFunction<Throwable, DataFetchingEnvironment, GraphQLError> resolver) {
147-
148-
return new DataFetcherExceptionResolverAdapter() {
149-
150-
@Override
151-
protected GraphQLError resolveToSingleError(Throwable ex, DataFetchingEnvironment env) {
152-
return resolver.apply(ex, env);
153-
}
154-
};
155-
}
156-
157137
}

spring-graphql/src/main/java/org/springframework/graphql/server/WebSocketGraphQlRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class WebSocketGraphQlRequest extends WebGraphQlRequest {
4545
* Create an instance.
4646
* @deprecated as of 1.1.3 in favor of the constructor with cookies
4747
*/
48-
@Deprecated
48+
@Deprecated(since = "1.1.3", forRemoval = true)
4949
public WebSocketGraphQlRequest(
5050
URI uri, HttpHeaders headers, Map<String, Object> body, String id, @Nullable Locale locale,
5151
WebSocketSessionInfo sessionInfo) {

spring-graphql/src/main/java/org/springframework/graphql/server/webmvc/GraphQlWebSocketHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public WebSocketHttpRequestHandler initWebSocketHttpRequestHandler(HandshakeHand
148148
* propagate context.
149149
* @deprecated as of 1.1.0 in favor of {@link #initWebSocketHttpRequestHandler(HandshakeHandler)}
150150
*/
151-
@Deprecated
151+
@Deprecated(since = "1.1.0", forRemoval = true)
152152
public WebSocketHttpRequestHandler asWebSocketHttpRequestHandler(HandshakeHandler handshakeHandler) {
153153
return initWebSocketHttpRequestHandler(handshakeHandler);
154154
}

0 commit comments

Comments
 (0)