Skip to content

Commit 01991ad

Browse files
Fix/recursive interface definitions (#934)
* fix: recursive interface definitions for Product, etc. * devops: CI & Linter compliances met * devops: lint-code.yml updated --------- Co-authored-by: Geoff Taylor <geoff@axistaylor.com>
1 parent 24dede2 commit 01991ad

10 files changed

+11
-11
lines changed

.github/workflows/lint-code.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
composer install
3737
3838
- name: Cache dependencies
39-
uses: actions/cache@v1
39+
uses: actions/cache@v4
4040
with:
4141
path: ${{ steps.composer-cache.outputs.dir }}
4242
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}

includes/class-core-schema-filters.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static function register_post_types( $args, $post_type ) {
127127
$args['graphql_single_name'] = 'Product';
128128
$args['graphql_plural_name'] = 'Products';
129129
$args['graphql_kind'] = 'interface';
130-
$args['graphql_interfaces'] = [ 'ContentNode' ];
130+
$args['graphql_interfaces'] = [ 'ContentNode', 'ProductUnion' ];
131131
$args['graphql_register_root_field'] = false;
132132
$args['graphql_register_root_connection'] = false;
133133
$args['graphql_resolve_type'] = [ self::class, 'resolve_product_type' ];
@@ -143,8 +143,8 @@ public static function register_post_types( $args, $post_type ) {
143143
'Node',
144144
'NodeWithFeaturedImage',
145145
'ContentNode',
146-
'UniformResourceIdentifiable',
147146
'ProductUnion',
147+
'UniformResourceIdentifiable',
148148
'ProductWithPricing',
149149
'ProductWithDimensions',
150150
'InventoriedProduct',

includes/type/interface/class-downloadable-product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function register_interface(): void {
2525
'DownloadableProduct',
2626
[
2727
'description' => __( 'A downloadable product.', 'wp-graphql-woocommerce' ),
28-
'interfaces' => [ 'Node', 'Product' ],
28+
'interfaces' => [ 'Node' ],
2929
'fields' => self::get_fields(),
3030
'resolveType' => [ Core::class, 'resolve_product_type' ],
3131
]

includes/type/interface/class-inventoried-product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function register_interface(): void {
2525
'InventoriedProduct',
2626
[
2727
'description' => __( 'A product with stock information.', 'wp-graphql-woocommerce' ),
28-
'interfaces' => [ 'Node', 'Product' ],
28+
'interfaces' => [ 'Node' ],
2929
'fields' => self::get_fields(),
3030
'resolveType' => [ Core::class, 'resolve_product_type' ],
3131
]

includes/type/interface/class-product-union.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static function register_interface(): void {
2626
'ProductUnion',
2727
[
2828
'description' => __( 'Union between the product and product variation types', 'wp-graphql-woocommerce' ),
29-
'interfaces' => [ 'Node', 'Product' ],
29+
'interfaces' => [ 'Node' ],
3030
'fields' => self::get_fields(),
3131
'resolveType' => [ Core::class, 'resolve_product_type' ],
3232
]

includes/type/interface/class-product-with-attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function register_interface(): void {
2929
'ProductWithAttributes',
3030
[
3131
'description' => __( 'Products with default attributes.', 'wp-graphql-woocommerce' ),
32-
'interfaces' => [ 'Node', 'Product' ],
32+
'interfaces' => [ 'Node' ],
3333
'fields' => self::get_fields(),
3434
'connections' => self::get_connections(),
3535
'resolveType' => [ Core::class, 'resolve_product_type' ],

includes/type/interface/class-product-with-dimensions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function register_interface(): void {
2525
'ProductWithDimensions',
2626
[
2727
'description' => __( 'A physical product.', 'wp-graphql-woocommerce' ),
28-
'interfaces' => [ 'Node', 'Product' ],
28+
'interfaces' => [ 'Node' ],
2929
'fields' => self::get_fields(),
3030
'resolveType' => [ Core::class, 'resolve_product_type' ],
3131
]

includes/type/interface/class-product-with-pricing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function register_interface(): void {
2525
'ProductWithPricing',
2626
[
2727
'description' => __( 'Products with pricing.', 'wp-graphql-woocommerce' ),
28-
'interfaces' => [ 'Node', 'Product' ],
28+
'interfaces' => [ 'Node' ],
2929
'fields' => self::get_fields(),
3030
'resolveType' => [ Core::class, 'resolve_product_type' ],
3131
]

includes/type/interface/class-product-with-variations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function register_interface(): void {
2929
'ProductWithVariations',
3030
[
3131
'description' => __( 'A product with variations.', 'wp-graphql-woocommerce' ),
32-
'interfaces' => [ 'Node', 'Product', 'ProductWithAttributes' ],
32+
'interfaces' => [ 'Node', 'ProductWithAttributes' ],
3333
'fields' => self::get_fields(),
3434
'connections' => self::get_connections(),
3535
'resolveType' => [ Core::class, 'resolve_product_type' ],

tests/wpunit/ProductQueriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ public function testProductQueryWithInterfaces() {
960960
reviewsAllowed
961961
purchaseNote
962962
menuOrder
963+
virtual
963964
... on ProductWithPricing {
964965
price
965966
regularPrice
@@ -985,7 +986,6 @@ public function testProductQueryWithInterfaces() {
985986
shippingTaxable
986987
}
987988
... on DownloadableProduct {
988-
virtual
989989
downloadExpiry
990990
downloadable
991991
downloadLimit

0 commit comments

Comments
 (0)