Skip to content

Commit

Permalink
fix: deprecated fields (#11)
Browse files Browse the repository at this point in the history
* Add breaking test
* Fix issue.
  • Loading branch information
maccath authored Aug 11, 2020
1 parent b24a021 commit c1c2033
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Utils/FederatedSchemaPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use GraphQL\Type\Definition\UnionType;
use GraphQL\Type\Introspection;
use GraphQL\Type\Schema;
use GraphQL\Utils\AST;
use GraphQL\Utils\Utils;

use Apollo\Federation\Types\EntityObjectType;
Expand Down
4 changes: 4 additions & 0 deletions test/StarWarsSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ public static function getEpisodesSchema(): FederatedSchema
'resolve' => function () {
return StarWarsData::getEpisodes();
}
],
'deprecatedEpisodes' => [
'type' => Type::nonNull(Type::listOf(Type::nonNull($episodeType))),
'deprecationReason' => 'Because you should use the other one.'
]
]
]);
Expand Down
1 change: 1 addition & 0 deletions test/__snapshots__/SchemaTest__testSchemaSdl__1.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
type Query {
episodes: [Episode!]!
deprecatedEpisodes: [Episode!]! @deprecated(reason: "Because you should use the other one.")
_service: _Service!
_entities(representations: [_Any!]!): [_Entity]
}
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/SchemaTest__testServiceSdl__1.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data:
_service:
sdl: "\"\"\"A character in the Star Wars Trilogy\"\"\"\nextend type Character @key(fields: \"id\") {\n id: Int! @external\n name: String! @external\n locations: [Location]! @requires(fields: \"name\")\n}\n\n\"\"\"A film in the Star Wars Trilogy\"\"\"\ntype Episode @key(fields: \"id\") {\n id: Int! \n title: String! \n characters: [Character!]! @provides(fields: \"name\")\n}\n\n\"\"\"A location in the Star Wars Trilogy\"\"\"\nextend type Location @key(fields: \"id\") {\n id: Int! @external\n name: String! @external\n}\n\nextend type Query {\n episodes: [Episode!]! \n}\n"
sdl: "\"\"\"A character in the Star Wars Trilogy\"\"\"\nextend type Character @key(fields: \"id\") {\n id: Int! @external\n name: String! @external\n locations: [Location]! @requires(fields: \"name\")\n}\n\n\"\"\"A film in the Star Wars Trilogy\"\"\"\ntype Episode @key(fields: \"id\") {\n id: Int! \n title: String! \n characters: [Character!]! @provides(fields: \"name\")\n}\n\n\"\"\"A location in the Star Wars Trilogy\"\"\"\nextend type Location @key(fields: \"id\") {\n id: Int! @external\n name: String! @external\n}\n\nextend type Query {\n episodes: [Episode!]! \n deprecatedEpisodes: [Episode!]! @deprecated(reason: \"Because you should use the other one.\") \n}\n"

0 comments on commit c1c2033

Please sign in to comment.