Skip to content

Fix/recursive interface definitions #934

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
composer install

- name: Cache dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
4 changes: 2 additions & 2 deletions includes/class-core-schema-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static function register_post_types( $args, $post_type ) {
$args['graphql_single_name'] = 'Product';
$args['graphql_plural_name'] = 'Products';
$args['graphql_kind'] = 'interface';
$args['graphql_interfaces'] = [ 'ContentNode' ];
$args['graphql_interfaces'] = [ 'ContentNode', 'ProductUnion' ];
$args['graphql_register_root_field'] = false;
$args['graphql_register_root_connection'] = false;
$args['graphql_resolve_type'] = [ self::class, 'resolve_product_type' ];
Expand All @@ -143,8 +143,8 @@ public static function register_post_types( $args, $post_type ) {
'Node',
'NodeWithFeaturedImage',
'ContentNode',
'UniformResourceIdentifiable',
'ProductUnion',
'UniformResourceIdentifiable',
'ProductWithPricing',
'ProductWithDimensions',
'InventoriedProduct',
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-downloadable-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function register_interface(): void {
'DownloadableProduct',
[
'description' => __( 'A downloadable product.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-inventoried-product.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function register_interface(): void {
'InventoriedProduct',
[
'description' => __( 'A product with stock information.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-product-union.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function register_interface(): void {
'ProductUnion',
[
'description' => __( 'Union between the product and product variation types', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-product-with-attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function register_interface(): void {
'ProductWithAttributes',
[
'description' => __( 'Products with default attributes.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'connections' => self::get_connections(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-product-with-dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function register_interface(): void {
'ProductWithDimensions',
[
'description' => __( 'A physical product.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-product-with-pricing.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static function register_interface(): void {
'ProductWithPricing',
[
'description' => __( 'Products with pricing.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product' ],
'interfaces' => [ 'Node' ],
'fields' => self::get_fields(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
]
Expand Down
2 changes: 1 addition & 1 deletion includes/type/interface/class-product-with-variations.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function register_interface(): void {
'ProductWithVariations',
[
'description' => __( 'A product with variations.', 'wp-graphql-woocommerce' ),
'interfaces' => [ 'Node', 'Product', 'ProductWithAttributes' ],
'interfaces' => [ 'Node', 'ProductWithAttributes' ],
'fields' => self::get_fields(),
'connections' => self::get_connections(),
'resolveType' => [ Core::class, 'resolve_product_type' ],
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/ProductQueriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,7 @@ public function testProductQueryWithInterfaces() {
reviewsAllowed
purchaseNote
menuOrder
virtual
... on ProductWithPricing {
price
regularPrice
Expand All @@ -985,7 +986,6 @@ public function testProductQueryWithInterfaces() {
shippingTaxable
}
... on DownloadableProduct {
virtual
downloadExpiry
downloadable
downloadLimit
Expand Down
Loading