Skip to content

Commit

Permalink
Deprecate GraphQL media type in favor of new one
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bclozel committed Dec 2, 2022
1 parent b1fdb14 commit 0ccd2f8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion spring-web/src/main/java/org/springframework/http/MediaType.java
Expand Up @@ -98,16 +98,34 @@ public class MediaType extends MimeType implements Serializable {
/**
* Public constant media type for {@code application/graphql+json}.
* @since 5.3.19
* @see <a href="https://github.com/graphql/graphql-over-http">GraphQL over HTTP spec</a>
* @see <a href="https://github.com/graphql/graphql-over-http/pull/215">GraphQL over HTTP spec change</a>
* @deprecated as of 6.0.3, in favor of {@link MediaType#APPLICATION_GRAPHQL_RESPONSE}
*/
@Deprecated(since = "6.0.3", forRemoval = true)
public static final MediaType APPLICATION_GRAPHQL;

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

/**
* Public constant media type for {@code application/graphql-response+json}.
* @since 6.0.3
* @see <a href="https://github.com/graphql/graphql-over-http">GraphQL over HTTP spec</a>
*/
public static final MediaType APPLICATION_GRAPHQL_RESPONSE;

/**
* A String equivalent of {@link MediaType#APPLICATION_GRAPHQL_RESPONSE}.
* @since 6.0.3
*/
public static final String APPLICATION_GRAPHQL_RESPONSE_VALUE = "application/graphql-response+json";


/**
* Public constant media type for {@code application/json}.
*/
Expand Down Expand Up @@ -422,6 +440,7 @@ public class MediaType extends MimeType implements Serializable {
APPLICATION_CBOR = new MediaType("application", "cbor");
APPLICATION_FORM_URLENCODED = new MediaType("application", "x-www-form-urlencoded");
APPLICATION_GRAPHQL = new MediaType("application", "graphql+json");
APPLICATION_GRAPHQL_RESPONSE = new MediaType("application", "graphql-response+json");
APPLICATION_JSON = new MediaType("application", "json");
APPLICATION_JSON_UTF8 = new MediaType("application", "json", StandardCharsets.UTF_8);
APPLICATION_NDJSON = new MediaType("application", "x-ndjson");
Expand Down

0 comments on commit 0ccd2f8

Please sign in to comment.