-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Apollo Federation v2 #26
Open
Aeliot-Tm
wants to merge
41
commits into
Skillshare:main
Choose a base branch
from
Aeliot-Tm:implement_v2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
2a39bee
Use Enum class as single source of directive names
a-melnikov c0ff092
Use constants as single source of entity config options names
a-melnikov 68ec4c5
Fix code style
a-melnikov 90231df
Create TypeEnum as single source of type names
a-melnikov 9af5719
Fix code style
a-melnikov 877810b
Fix code style
a-melnikov 268eee6
Print simple and compound directives' argument "fields"
a-melnikov 0769802
Declare reserved names
a-melnikov 6849706
Fix code style
a-melnikov df46520
Fixes during investigation
a-melnikov 79e14dc
Update phpDocs
a-melnikov 245f9ad
Make printer better extendable
a-melnikov cd86cde
Extend base schema printer and reduce copy-paste
a-melnikov 5077032
Reduce copy-paste & fix code style
a-melnikov d23332d
Refactor code to make more readable
a-melnikov 5724b2c
Fix code style
a-melnikov 3e217de
Extract FederatedSchemaTrait
a-melnikov 4a21ab5
Fix code style
a-melnikov 8ad0047
Fix tests code style
a-melnikov e0c45d7
Fix method call params order
a-melnikov 10a2a4a
Fix code style
a-melnikov b5d5e48
Sort schema printer methods
a-melnikov 17bf125
Add directives of Apollo Federation v2
a-melnikov c0f3941
Implement directive @link
a-melnikov 1bac625
Add handling of argument "resolvable" of directive @key
a-melnikov 970ca0b
Extend validation of type reference
a-melnikov 75f8b3a
Add validation if Referenced entity has only one @key directive.
a-melnikov 86ae658
Rename file "phpunit.xml" to "phpunit.xml.dist" to stick to standard …
a-melnikov ae58a6e
Extract getting of required federated directives to the schema builder
a-melnikov 78ba78c
Fix extendability of schema
a-melnikov fe7456c
Update phpdoc
a-melnikov 258c46f
Merge branch 'main' into implement_v2
a-melnikov 408c3e1
Remove deprecated excess classes imports
a-melnikov 07a0f9e
Fix merge conflict: make updates equivalent to the commit 4f958ddb683…
a-melnikov a34d336
Fix documentation
a-melnikov edce728
Implement tests
a-melnikov 3562fe3
Implement tests
a-melnikov 7002d92
Fix test failed assertion message.
a-melnikov 1b663b5
Update entity reference resolver validation
a-melnikov 60feec3
Remove excess class import
a-melnikov b818787
Downgrade to PHP 7.1
a-melnikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
.idea | ||
.vscode | ||
composer.phar | ||
/vendor/ | ||
/node_modules/ | ||
*.cache | ||
cov.xml | ||
.idea | ||
.vscode | ||
phpunit.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Apollo\Federation\Directives; | ||
|
||
use Apollo\Federation\Enum\DirectiveEnum; | ||
use GraphQL\Language\DirectiveLocation; | ||
use GraphQL\Type\Definition\Directive; | ||
|
||
/** | ||
* The `@inaccessible` directive indicates that a field or type should be omitted from the gateway's API schema, | ||
* even if it's also defined in other subgraphs. | ||
* | ||
* @see https://www.apollographql.com/docs/federation/federated-types/federated-directives/#inaccessible | ||
*/ | ||
class InaccessibleDirective extends Directive | ||
{ | ||
public function __construct() | ||
{ | ||
parent::__construct([ | ||
'name' => DirectiveEnum::INACCESSIBLE, | ||
'locations' => [ | ||
DirectiveLocation::FIELD_DEFINITION, | ||
DirectiveLocation::IFACE, | ||
DirectiveLocation::OBJECT, | ||
DirectiveLocation::UNION, | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider dropping support for PHP 7.4 now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downgraded to PHP 7.1
But it cannot be tested on this version of PHP. It was locked implicitly on php >=7.3 when required PHPunit ^9.5
apollo-federation-php/composer.json
Line 30 in c1bc216
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if the version bump could happen in #31 , and this PR could become mergeable without this PHP bump first. A minor release can happen first, and the version bumps of #31 can happen in a major breaking release.
When considering the version bump the Stitcher blogposts are helpful: https://stitcher.io/blog/php-version-stats-january-2023
The one thing I am always curious about is how much % of these stats are caused by CI pipelines (and hence the actual PHP <= 7.4 usage is lower).
The PHP supported versions is a better guidance, especially when considering a major release as a library.
The old library versions will still remain available through Packagist, and the need for new functionality will stimulate engineers to get their PHP versions updated.