From a96e7b3330c78b5960056302f130f2094f2d75da Mon Sep 17 00:00:00 2001 From: BoD Date: Thu, 6 Nov 2025 16:19:17 +0100 Subject: [PATCH] Add a SchemaDownloader test that converts to SDL --- ...spection-request-september2025-oneOf.json} | 0 ... introspection-request-september2025.json} | 0 ...trospection-response-success-full.graphqls | 495 +++++ .../introspection-response-success-full.json | 1795 +++++++++++++++++ ...pection-response-september2025-oneOf.json} | 0 ...introspection-response-september2025.json} | 0 .../apollo/tooling/SchemaDownloaderTests.kt | 99 +- 7 files changed, 2354 insertions(+), 35 deletions(-) rename libraries/apollo-tooling/src/test/fixtures/{introspection-request-oneOf.json => introspection-request-september2025-oneOf.json} (100%) rename libraries/apollo-tooling/src/test/fixtures/{introspection-request-draft.json => introspection-request-september2025.json} (100%) create mode 100644 libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.graphqls create mode 100644 libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.json rename libraries/apollo-tooling/src/test/fixtures/{pre-introspection-response-oneOf.json => pre-introspection-response-september2025-oneOf.json} (100%) rename libraries/apollo-tooling/src/test/fixtures/{pre-introspection-response-draft.json => pre-introspection-response-september2025.json} (100%) diff --git a/libraries/apollo-tooling/src/test/fixtures/introspection-request-oneOf.json b/libraries/apollo-tooling/src/test/fixtures/introspection-request-september2025-oneOf.json similarity index 100% rename from libraries/apollo-tooling/src/test/fixtures/introspection-request-oneOf.json rename to libraries/apollo-tooling/src/test/fixtures/introspection-request-september2025-oneOf.json diff --git a/libraries/apollo-tooling/src/test/fixtures/introspection-request-draft.json b/libraries/apollo-tooling/src/test/fixtures/introspection-request-september2025.json similarity index 100% rename from libraries/apollo-tooling/src/test/fixtures/introspection-request-draft.json rename to libraries/apollo-tooling/src/test/fixtures/introspection-request-september2025.json diff --git a/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.graphqls b/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.graphqls new file mode 100644 index 00000000000..3bf5e55aa4a --- /dev/null +++ b/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.graphqls @@ -0,0 +1,495 @@ +""" +A custom scalar representing a point in time. +""" +scalar DateTime + +""" +Episodes of the Star Wars saga. +""" +enum Episode { + """ + Released in 1977. + """ + NEWHOPE + + """ + Released in 1980. + """ + EMPIRE + + """ + Released in 1983. Deprecated for lore reasons. + """ + JEDI @deprecated(reason: "Too old for modern sequels") +} + +""" +A common interface for all characters. +""" +interface Character { + """ + The unique ID of the character. + """ + id: ID! + + """ + The character’s name. + """ + name: String! + + """ + Episodes in which this character appears. + """ + appearsIn: [Episode!]! +} + +""" +The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID. +""" +scalar ID + +""" +The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text. +""" +scalar String + +""" +A human character. +""" +type Human implements Character { + id: ID! + + name: String! + + appearsIn: [Episode!]! + + """ + Planet of origin. + """ + homePlanet: String + + """ + Deprecated field. + """ + oldField: String @deprecated(reason: "Use 'homePlanet' instead") +} + +""" +A mechanical character. +""" +type Droid implements Character { + id: ID! + + name: String! + + appearsIn: [Episode!]! + + """ + Primary function of the droid. + """ + primaryFunction: String +} + +""" +Search results may be a Human or a Droid. +""" +union SearchResult = Human|Droid + +""" +Units for measuring length. +""" +enum LengthUnit { + METER + + FOOT +} + +""" +Input type for submitting a review. +""" +input ReviewInput { + """ + Star rating from 1–5. + """ + stars: Int! + + """ + Optional review text. + """ + commentary: String + + """ + Deprecated input field. + """ + oldComment: String @deprecated(reason: "Renamed to 'commentary'") +} + +""" +The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1. +""" +scalar Int + +""" +A review written by a user. +""" +type Review { + stars: Int! + + commentary: String + + createdAt: DateTime! +} + +""" +Root query operations. +""" +type Query { + """ + Fetch the hero for a given episode. + """ + hero("Episode to fetch the hero for." episode: Episode @deprecated(reason: "Deprecated argument example")): Character + + """ + Search across characters. + """ + search(text: String!): [SearchResult!]! + + """ + Current server time. + """ + currentTime: DateTime! +} + +""" +Root mutation operations. +""" +type Mutation { + """ + Create a new review for an episode. + """ + createReview(episode: Episode!, review: ReviewInput!): Review! +} + +""" +Root subscription operations. +""" +type Subscription { + """ + Triggered whenever a new review is added. + """ + reviewAdded(episode: Episode!): Review! +} + +""" +The `Boolean` scalar type represents `true` or `false`. +""" +scalar Boolean + +""" +A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations. +""" +type __Schema { + description: String + + """ + A list of all types supported by this server. + """ + types: [__Type!]! + + """ + The type that query operations will be rooted at. + """ + queryType: __Type! + + """ + If this server supports mutation, the type that mutation operations will be rooted at. + """ + mutationType: __Type + + """ + If this server support subscription, the type that subscription operations will be rooted at. + """ + subscriptionType: __Type + + """ + A list of all directives supported by this server. + """ + directives: [__Directive!]! +} + +""" +The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum. + +Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types. +""" +type __Type { + kind: __TypeKind! + + name: String + + description: String + + specifiedByURL: String + + fields(includeDeprecated: Boolean! = false): [__Field!] + + interfaces: [__Type!] + + possibleTypes: [__Type!] + + enumValues(includeDeprecated: Boolean! = false): [__EnumValue!] + + inputFields(includeDeprecated: Boolean! = false): [__InputValue!] + + ofType: __Type + + isOneOf: Boolean +} + +""" +An enum describing what kind of type a given `__Type` is. +""" +enum __TypeKind { + """ + Indicates this type is a scalar. + """ + SCALAR + + """ + Indicates this type is an object. `fields` and `interfaces` are valid fields. + """ + OBJECT + + """ + Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields. + """ + INTERFACE + + """ + Indicates this type is a union. `possibleTypes` is a valid field. + """ + UNION + + """ + Indicates this type is an enum. `enumValues` is a valid field. + """ + ENUM + + """ + Indicates this type is an input object. `inputFields` is a valid field. + """ + INPUT_OBJECT + + """ + Indicates this type is a list. `ofType` is a valid field. + """ + LIST + + """ + Indicates this type is a non-null. `ofType` is a valid field. + """ + NON_NULL +} + +""" +Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type. +""" +type __Field { + name: String! + + description: String + + args(includeDeprecated: Boolean! = false): [__InputValue!]! + + type: __Type! + + isDeprecated: Boolean! + + deprecationReason: String +} + +""" +Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value. +""" +type __InputValue { + name: String! + + description: String + + type: __Type! + + """ + A GraphQL-formatted string representing the default value for this input value. + """ + defaultValue: String + + isDeprecated: Boolean! + + deprecationReason: String +} + +""" +One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string. +""" +type __EnumValue { + name: String! + + description: String + + isDeprecated: Boolean! + + deprecationReason: String +} + +""" +A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document. + +In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor. +""" +type __Directive { + name: String! + + description: String + + isRepeatable: Boolean! + + locations: [__DirectiveLocation!]! + + args(includeDeprecated: Boolean! = false): [__InputValue!]! +} + +""" +A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies. +""" +enum __DirectiveLocation { + """ + Location adjacent to a query operation. + """ + QUERY + + """ + Location adjacent to a mutation operation. + """ + MUTATION + + """ + Location adjacent to a subscription operation. + """ + SUBSCRIPTION + + """ + Location adjacent to a field. + """ + FIELD + + """ + Location adjacent to a fragment definition. + """ + FRAGMENT_DEFINITION + + """ + Location adjacent to a fragment spread. + """ + FRAGMENT_SPREAD + + """ + Location adjacent to an inline fragment. + """ + INLINE_FRAGMENT + + """ + Location adjacent to an operation variable definition. + """ + VARIABLE_DEFINITION + + """ + Location adjacent to a fragment variable definition. + """ + FRAGMENT_VARIABLE_DEFINITION + + """ + Location adjacent to a schema definition. + """ + SCHEMA + + """ + Location adjacent to a scalar definition. + """ + SCALAR + + """ + Location adjacent to an object type definition. + """ + OBJECT + + """ + Location adjacent to a field definition. + """ + FIELD_DEFINITION + + """ + Location adjacent to an argument definition. + """ + ARGUMENT_DEFINITION + + """ + Location adjacent to an interface definition. + """ + INTERFACE + + """ + Location adjacent to a union definition. + """ + UNION + + """ + Location adjacent to an enum definition. + """ + ENUM + + """ + Location adjacent to an enum value definition. + """ + ENUM_VALUE + + """ + Location adjacent to an input object type definition. + """ + INPUT_OBJECT + + """ + Location adjacent to an input object field definition. + """ + INPUT_FIELD_DEFINITION +} + +""" +Directs the executor to include this field or fragment only when the `if` argument is true. +""" +directive @include ("Included when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT + +""" +Directs the executor to skip this field or fragment when the `if` argument is true. +""" +directive @skip ("Skipped when true." if: Boolean!) on FIELD|FRAGMENT_SPREAD|INLINE_FRAGMENT + +""" +Marks an element of a GraphQL schema as no longer supported. +""" +directive @deprecated ("Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/)." reason: String! = "No longer supported") on FIELD_DEFINITION|ARGUMENT_DEFINITION|INPUT_FIELD_DEFINITION|ENUM_VALUE + +""" +Exposes a URL that specifies the behavior of this scalar. +""" +directive @specifiedBy ("The URL that specifies the behavior of this scalar." url: String!) on SCALAR + +""" +Indicates exactly one field must be supplied and this field must not be `null`. +""" +directive @oneOf on INPUT_OBJECT + +schema { + query: Query + mutation: Mutation + subscription: Subscription +} diff --git a/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.json b/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.json new file mode 100644 index 00000000000..5e6e920728d --- /dev/null +++ b/libraries/apollo-tooling/src/test/fixtures/introspection-response-success-full.json @@ -0,0 +1,1795 @@ +{ + "data": { + "__schema": { + "queryType": { + "name": "Query" + }, + "mutationType": { + "name": "Mutation" + }, + "subscriptionType": { + "name": "Subscription" + }, + "types": [ + { + "kind": "SCALAR", + "name": "DateTime", + "description": "A custom scalar representing a point in time.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "ENUM", + "name": "Episode", + "description": "Episodes of the Star Wars saga.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "NEWHOPE", + "description": "Released in 1977.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "EMPIRE", + "description": "Released in 1980.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "JEDI", + "description": "Released in 1983. Deprecated for lore reasons.", + "isDeprecated": true, + "deprecationReason": "Too old for modern sequels" + } + ], + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "INTERFACE", + "name": "Character", + "description": "A common interface for all characters.", + "fields": [ + { + "name": "id", + "description": "The unique ID of the character.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The character’s name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "appearsIn", + "description": "Episodes in which this character appears.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Human", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Droid", + "ofType": null + } + ], + "specifiedByURL": null + }, + { + "kind": "SCALAR", + "name": "ID", + "description": "The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Human", + "description": "A human character.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "appearsIn", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "homePlanet", + "description": "Planet of origin.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oldField", + "description": "Deprecated field.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": true, + "deprecationReason": "Use 'homePlanet' instead" + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Character", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Droid", + "description": "A mechanical character.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "appearsIn", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "primaryFunction", + "description": "Primary function of the droid.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Character", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "UNION", + "name": "SearchResult", + "description": "Search results may be a Human or a Droid.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Human", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Droid", + "ofType": null + } + ], + "specifiedByURL": null + }, + { + "kind": "ENUM", + "name": "LengthUnit", + "description": "Units for measuring length.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "METER", + "description": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FOOT", + "description": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ReviewInput", + "description": "Input type for submitting a review.", + "fields": null, + "inputFields": [ + { + "name": "stars", + "description": "Star rating from 1–5.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commentary", + "description": "Optional review text.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oldComment", + "description": "Deprecated input field.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Renamed to 'commentary'" + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "SCALAR", + "name": "Int", + "description": "The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Review", + "description": "A review written by a user.", + "fields": [ + { + "name": "stars", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commentary", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Query", + "description": "Root query operations.", + "fields": [ + { + "name": "hero", + "description": "Fetch the hero for a given episode.", + "args": [ + { + "name": "episode", + "description": "Episode to fetch the hero for.", + "type": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + }, + "defaultValue": null, + "isDeprecated": true, + "deprecationReason": "Deprecated argument example" + } + ], + "type": { + "kind": "INTERFACE", + "name": "Character", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "search", + "description": "Search across characters.", + "args": [ + { + "name": "text", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "SearchResult", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currentTime", + "description": "Current server time.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Mutation", + "description": "Root mutation operations.", + "fields": [ + { + "name": "createReview", + "description": "Create a new review for an episode.", + "args": [ + { + "name": "episode", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "review", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ReviewInput", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Review", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "Subscription", + "description": "Root subscription operations.", + "fields": [ + { + "name": "reviewAdded", + "description": "Triggered whenever a new review is added.", + "args": [ + { + "name": "episode", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "Episode", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Review", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "SCALAR", + "name": "Boolean", + "description": "The `Boolean` scalar type represents `true` or `false`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Directive", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__TypeKind", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "specifiedByURL", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Field", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__EnumValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isOneOf", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isRepeatable", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__DirectiveLocation", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "args", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": "false", + "isDeprecated": false, + "deprecationReason": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null, + "specifiedByURL": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "VARIABLE_DEFINITION", + "description": "Location adjacent to an operation variable definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_VARIABLE_DEFINITION", + "description": "Location adjacent to a fragment variable definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null, + "specifiedByURL": null + } + ], + "directives": [ + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "locations": [ + "FIELD", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT" + ], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "locations": [ + "FIELD_DEFINITION", + "ARGUMENT_DEFINITION", + "INPUT_FIELD_DEFINITION", + "ENUM_VALUE" + ], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": "\"No longer supported\"", + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "specifiedBy", + "description": "Exposes a URL that specifies the behavior of this scalar.", + "locations": [ + "SCALAR" + ], + "args": [ + { + "name": "url", + "description": "The URL that specifies the behavior of this scalar.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null, + "isDeprecated": false, + "deprecationReason": null + } + ], + "isRepeatable": false + }, + { + "name": "oneOf", + "description": "Indicates exactly one field must be supplied and this field must not be `null`.", + "locations": [ + "INPUT_OBJECT" + ], + "args": [], + "isRepeatable": false + } + ], + "description": null + } + } +} diff --git a/libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-oneOf.json b/libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-september2025-oneOf.json similarity index 100% rename from libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-oneOf.json rename to libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-september2025-oneOf.json diff --git a/libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-draft.json b/libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-september2025.json similarity index 100% rename from libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-draft.json rename to libraries/apollo-tooling/src/test/fixtures/pre-introspection-response-september2025.json diff --git a/libraries/apollo-tooling/src/test/kotlin/com/apollographql/apollo/tooling/SchemaDownloaderTests.kt b/libraries/apollo-tooling/src/test/kotlin/com/apollographql/apollo/tooling/SchemaDownloaderTests.kt index 2a20ebf05a0..1a7c36b172e 100644 --- a/libraries/apollo-tooling/src/test/kotlin/com/apollographql/apollo/tooling/SchemaDownloaderTests.kt +++ b/libraries/apollo-tooling/src/test/kotlin/com/apollographql/apollo/tooling/SchemaDownloaderTests.kt @@ -16,29 +16,37 @@ private val introspectionRequestJune2018 = pathToUtf8("apollo-tooling/src/test/f private val preIntrospectionResponseOctober2021 = pathToUtf8("apollo-tooling/src/test/fixtures/pre-introspection-response-october2021.json") private val introspectionRequestOctober2021 = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-october2021.json") -private val preIntrospectionResponseDraft = pathToUtf8("apollo-tooling/src/test/fixtures/pre-introspection-response-draft.json") -private val introspectionRequestDraft = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-draft.json") +private val preIntrospectionResponseSeptember2025 = + pathToUtf8("apollo-tooling/src/test/fixtures/pre-introspection-response-september2025.json") +private val introspectionRequestSeptember2025 = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-september2025.json") -private val preIntrospectionResponseOneOf = pathToUtf8("apollo-tooling/src/test/fixtures/pre-introspection-response-oneOf.json") -private val introspectionRequestOneOf = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-oneOf.json") +private val preIntrospectionResponseSeptember2025OneOf = + pathToUtf8("apollo-tooling/src/test/fixtures/pre-introspection-response-september2025-oneOf.json") +private val introspectionRequestSeptember2025OneOf = + pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-september2025-oneOf.json") private val introspectionRequestFailSafe = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-request-failSafe.json") private val introspectionResponseSuccess = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-response-success.json") +private val introspectionResponseSuccessFullJson = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-response-success-full.json") +private val introspectionResponseSuccessFullSdl = + pathToUtf8("apollo-tooling/src/test/fixtures/introspection-response-success-full.graphqls") private val introspectionResponseFail = pathToUtf8("apollo-tooling/src/test/fixtures/introspection-response-fail.json") class SchemaDownloaderTests { private lateinit var mockServer: MockServer - private lateinit var tempFile: File + private lateinit var tempFileJson: File + private lateinit var tempFileSdl: File private fun setUp() { mockServer = MockServer() - tempFile = File.createTempFile("schema", ".json") + tempFileJson = File.createTempFile("schema", ".json") + tempFileSdl = File.createTempFile("schema", ".graphqls") } private fun tearDown() { mockServer.close() - tempFile.delete() + tempFileJson.delete() } @Test @@ -51,13 +59,13 @@ class SchemaDownloaderTests { graph = null, key = null, graphVariant = "", - schema = tempFile, + schema = tempFileJson, ) mockServer.takeRequest() val introspectionRequest = mockServer.takeRequest().body.utf8() assertEquals(introspectionRequestJune2018, introspectionRequest) - assertEquals(introspectionResponseSuccess, tempFile.readText()) + assertEquals(introspectionResponseSuccess, tempFileJson.readText()) } @Test @@ -70,18 +78,18 @@ class SchemaDownloaderTests { graph = null, key = null, graphVariant = "", - schema = tempFile, + schema = tempFileJson, ) mockServer.takeRequest() val introspectionRequest = mockServer.takeRequest().body.utf8() assertEquals(introspectionRequestOctober2021, introspectionRequest) - assertEquals(introspectionResponseSuccess, tempFile.readText()) + assertEquals(introspectionResponseSuccess, tempFileJson.readText()) } @Test - fun `schema is downloaded correctly when server supports Draft spec as of 2023-11-15`() = runTest(before = { setUp() }, after = { tearDown() }) { - mockServer.enqueueString(preIntrospectionResponseDraft) + fun `schema is downloaded correctly when server supports September 2025 spec`() = runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString(preIntrospectionResponseSeptember2025) mockServer.enqueueString(introspectionResponseSuccess) SchemaDownloader.download( @@ -89,37 +97,58 @@ class SchemaDownloaderTests { graph = null, key = null, graphVariant = "", - schema = tempFile, + schema = tempFileJson, ) mockServer.takeRequest() val introspectionRequest = mockServer.takeRequest().body.utf8() - assertEquals(introspectionRequestDraft, introspectionRequest) - assertEquals(introspectionResponseSuccess, tempFile.readText()) + assertEquals(introspectionRequestSeptember2025, introspectionRequest) + assertEquals(introspectionResponseSuccess, tempFileJson.readText()) } @Test - fun `schema is downloaded correctly when server supports oneOf`() = runTest(before = { setUp() }, after = { tearDown() }) { - mockServer.enqueueString(preIntrospectionResponseOneOf) - mockServer.enqueueString(introspectionResponseSuccess) - - SchemaDownloader.download( - endpoint = mockServer.url(), - graph = null, - key = null, - graphVariant = "", - schema = tempFile, - ) + fun `full schema is downloaded and converted correctly to SDL when server supports September 2025 spec`() = + runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString(preIntrospectionResponseSeptember2025) + mockServer.enqueueString(introspectionResponseSuccessFullJson) + + SchemaDownloader.download( + endpoint = mockServer.url(), + graph = null, + key = null, + graphVariant = "", + schema = tempFileSdl, + ) + + mockServer.takeRequest() + val introspectionRequest = mockServer.takeRequest().body.utf8() + assertEquals(introspectionRequestSeptember2025, introspectionRequest) + assertEquals(introspectionResponseSuccessFullSdl, tempFileSdl.readText()) + } - mockServer.takeRequest() - val introspectionRequest = mockServer.takeRequest().body.utf8() - assertEquals(introspectionRequestOneOf, introspectionRequest) - assertEquals(introspectionResponseSuccess, tempFile.readText()) - } + @Test + fun `schema is downloaded correctly when server supports September 2025 spec including oneOf`() = + runTest(before = { setUp() }, after = { tearDown() }) { + mockServer.enqueueString(preIntrospectionResponseSeptember2025OneOf) + mockServer.enqueueString(introspectionResponseSuccess) + + SchemaDownloader.download( + endpoint = mockServer.url(), + graph = null, + key = null, + graphVariant = "", + schema = tempFileJson, + ) + + mockServer.takeRequest() + val introspectionRequest = mockServer.takeRequest().body.utf8() + assertEquals(introspectionRequestSeptember2025OneOf, introspectionRequest) + assertEquals(introspectionResponseSuccess, tempFileJson.readText()) + } @Test fun `schema is downloaded correctly in fail-safe mode after 2-step fails`() = runTest(before = { setUp() }, after = { tearDown() }) { - mockServer.enqueueString(preIntrospectionResponseDraft) + mockServer.enqueueString(preIntrospectionResponseSeptember2025) mockServer.enqueueString(introspectionResponseFail) mockServer.enqueueString(introspectionResponseSuccess) @@ -128,14 +157,14 @@ class SchemaDownloaderTests { graph = null, key = null, graphVariant = "", - schema = tempFile, + schema = tempFileJson, ) mockServer.takeRequest() mockServer.takeRequest() val introspectionRequest = mockServer.takeRequest().body.utf8() assertEquals(introspectionRequestFailSafe, introspectionRequest) - assertEquals(introspectionResponseSuccess, tempFile.readText()) + assertEquals(introspectionResponseSuccess, tempFileJson.readText()) } }