Skip to content

Commit 0ccd2f8

Browse files
committed
Deprecate GraphQL media type in favor of new one
This commit deprecates the `"application/graphql+json"` media type in favor of the new `"application/graphql-response+json"`, since the former has been removed in graphql/graphql-over-http#215. Closes gh-29617
1 parent b1fdb14 commit 0ccd2f8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

spring-web/src/main/java/org/springframework/http/MediaType.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,34 @@ public class MediaType extends MimeType implements Serializable {
9898
/**
9999
* Public constant media type for {@code application/graphql+json}.
100100
* @since 5.3.19
101-
* @see <a href="https://github.com/graphql/graphql-over-http">GraphQL over HTTP spec</a>
101+
* @see <a href="https://github.com/graphql/graphql-over-http/pull/215">GraphQL over HTTP spec change</a>
102+
* @deprecated as of 6.0.3, in favor of {@link MediaType#APPLICATION_GRAPHQL_RESPONSE}
102103
*/
104+
@Deprecated(since = "6.0.3", forRemoval = true)
103105
public static final MediaType APPLICATION_GRAPHQL;
104106

105107
/**
106108
* A String equivalent of {@link MediaType#APPLICATION_GRAPHQL}.
107109
* @since 5.3.19
110+
* @deprecated as of 6.0.3, in favor of {@link MediaType#APPLICATION_GRAPHQL_RESPONSE_VALUE}
108111
*/
112+
@Deprecated(since = "6.0.3", forRemoval = true)
109113
public static final String APPLICATION_GRAPHQL_VALUE = "application/graphql+json";
110114

115+
/**
116+
* Public constant media type for {@code application/graphql-response+json}.
117+
* @since 6.0.3
118+
* @see <a href="https://github.com/graphql/graphql-over-http">GraphQL over HTTP spec</a>
119+
*/
120+
public static final MediaType APPLICATION_GRAPHQL_RESPONSE;
121+
122+
/**
123+
* A String equivalent of {@link MediaType#APPLICATION_GRAPHQL_RESPONSE}.
124+
* @since 6.0.3
125+
*/
126+
public static final String APPLICATION_GRAPHQL_RESPONSE_VALUE = "application/graphql-response+json";
127+
128+
111129
/**
112130
* Public constant media type for {@code application/json}.
113131
*/
@@ -422,6 +440,7 @@ public class MediaType extends MimeType implements Serializable {
422440
APPLICATION_CBOR = new MediaType("application", "cbor");
423441
APPLICATION_FORM_URLENCODED = new MediaType("application", "x-www-form-urlencoded");
424442
APPLICATION_GRAPHQL = new MediaType("application", "graphql+json");
443+
APPLICATION_GRAPHQL_RESPONSE = new MediaType("application", "graphql-response+json");
425444
APPLICATION_JSON = new MediaType("application", "json");
426445
APPLICATION_JSON_UTF8 = new MediaType("application", "json", StandardCharsets.UTF_8);
427446
APPLICATION_NDJSON = new MediaType("application", "x-ndjson");

0 commit comments

Comments
 (0)