Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Make product variant attributes non-nullable

Patryk Zawadzki20479a43a0c2
diff --git a/saleor/graphql/product/types.py b/saleor/graphql/product/types.py
index 395d185545..39d063dbe4 100644
--- a/saleor/graphql/product/types.py
+++ b/saleor/graphql/product/types.py
@@ -135,7 +135,7 @@ class ProductVariant(CountableDjangoObjectType):
price is used."""))
price = graphene.Field(Money, description="Price of the product variant.")
attributes = graphene.List(
- SelectedAttribute,
+ graphene.NonNull(SelectedAttribute), required=True,
description='List of attributes assigned to this variant.')
cost_price = graphene.Field(
Money, description='Cost price of the variant.')
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index ab954c70d2..f325ff91f3 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -1507,7 +1507,7 @@ type ProductVariant implements Node {
name: String!
priceOverride: Money
product: Product!
- attributes: [SelectedAttribute]
+ attributes: [SelectedAttribute!]!
images(before: String, after: String, first: Int, last: Int): ProductImageCountableConnection
trackInventory: Boolean!
quantity: Int!
diff --git a/saleor/static/dashboard-next/home/types/Home.ts b/saleor/static/dashboard-next/home/types/Home.ts
index a2921b5da3..36830bcb0f 100644
--- a/saleor/static/dashboard-next/home/types/Home.ts
+++ b/saleor/static/dashboard-next/home/types/Home.ts
@@ -72,7 +72,7 @@ export interface Home_productTopToday_edges_node {
__typename: "ProductVariant";
id: string;
revenue: Home_productTopToday_edges_node_revenue | null;
- attributes: (Home_productTopToday_edges_node_attributes | null)[] | null;
+ attributes: Home_productTopToday_edges_node_attributes[];
product: Home_productTopToday_edges_node_product;
quantityOrdered: number | null;
}
diff --git a/saleor/static/dashboard-next/products/types/ProductVariant.ts b/saleor/static/dashboard-next/products/types/ProductVariant.ts
index 993b44f943..cab86af61f 100644
--- a/saleor/static/dashboard-next/products/types/ProductVariant.ts
+++ b/saleor/static/dashboard-next/products/types/ProductVariant.ts
@@ -125,7 +125,7 @@ export interface ProductVariant_product {
export interface ProductVariant {
__typename: "ProductVariant";
id: string;
- attributes: (ProductVariant_attributes | null)[] | null;
+ attributes: ProductVariant_attributes[];
costPrice: ProductVariant_costPrice | null;
images: ProductVariant_images | null;
name: string;
diff --git a/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts b/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts
index 5c3005bedb..1c5a2ffcc4 100644
--- a/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts
+++ b/saleor/static/dashboard-next/products/types/ProductVariantDetails.ts
@@ -125,7 +125,7 @@ export interface ProductVariantDetails_productVariant_product {
export interface ProductVariantDetails_productVariant {
__typename: "ProductVariant";
id: string;
- attributes: (ProductVariantDetails_productVariant_attributes | null)[] | null;
+ attributes: ProductVariantDetails_productVariant_attributes[];
costPrice: ProductVariantDetails_productVariant_costPrice | null;
images: ProductVariantDetails_productVariant_images | null;
name: string;
diff --git a/saleor/static/dashboard-next/products/types/VariantCreate.ts b/saleor/static/dashboard-next/products/types/VariantCreate.ts
index 123eee96e9..8cb32e65fb 100644
--- a/saleor/static/dashboard-next/products/types/VariantCreate.ts
+++ b/saleor/static/dashboard-next/products/types/VariantCreate.ts
@@ -133,7 +133,7 @@ export interface VariantCreate_productVariantCreate_productVariant_product {
export interface VariantCreate_productVariantCreate_productVariant {
__typename: "ProductVariant";
id: string;
- attributes: (VariantCreate_productVariantCreate_productVariant_attributes | null)[] | null;
+ attributes: VariantCreate_productVariantCreate_productVariant_attributes[];
costPrice: VariantCreate_productVariantCreate_productVariant_costPrice | null;
images: VariantCreate_productVariantCreate_productVariant_images | null;
name: string;
diff --git a/saleor/static/dashboard-next/products/types/VariantImageAssign.ts b/saleor/static/dashboard-next/products/types/VariantImageAssign.ts
index 49aab2c2bf..45ca56b6da 100644
--- a/saleor/static/dashboard-next/products/types/VariantImageAssign.ts
+++ b/saleor/static/dashboard-next/products/types/VariantImageAssign.ts
@@ -131,7 +131,7 @@ export interface VariantImageAssign_variantImageAssign_productVariant_product {
export interface VariantImageAssign_variantImageAssign_productVariant {
__typename: "ProductVariant";
id: string;
- attributes: (VariantImageAssign_variantImageAssign_productVariant_attributes | null)[] | null;
+ attributes: VariantImageAssign_variantImageAssign_productVariant_attributes[];
costPrice: VariantImageAssign_variantImageAssign_productVariant_costPrice | null;
images: VariantImageAssign_variantImageAssign_productVariant_images | null;
name: string;
diff --git a/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts b/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts
index e554bd59b2..919444a8d6 100644
--- a/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts
+++ b/saleor/static/dashboard-next/products/types/VariantImageUnassign.ts
@@ -131,7 +131,7 @@ export interface VariantImageUnassign_variantImageUnassign_productVariant_produc
export interface VariantImageUnassign_variantImageUnassign_productVariant {
__typename: "ProductVariant";
id: string;
- attributes: (VariantImageUnassign_variantImageUnassign_productVariant_attributes | null)[] | null;
+ attributes: VariantImageUnassign_variantImageUnassign_productVariant_attributes[];
costPrice: VariantImageUnassign_variantImageUnassign_productVariant_costPrice | null;
images: VariantImageUnassign_variantImageUnassign_productVariant_images | null;
name: string;
diff --git a/saleor/static/dashboard-next/products/types/VariantUpdate.ts b/saleor/static/dashboard-next/products/types/VariantUpdate.ts
index 0067906753..88c0cbbbc4 100644
--- a/saleor/static/dashboard-next/products/types/VariantUpdate.ts
+++ b/saleor/static/dashboard-next/products/types/VariantUpdate.ts
@@ -133,7 +133,7 @@ export interface VariantUpdate_productVariantUpdate_productVariant_product {
export interface VariantUpdate_productVariantUpdate_productVariant {
__typename: "ProductVariant";
id: string;
- attributes: (VariantUpdate_productVariantUpdate_productVariant_attributes | null)[] | null;
+ attributes: VariantUpdate_productVariantUpdate_productVariant_attributes[];
costPrice: VariantUpdate_productVariantUpdate_productVariant_costPrice | null;
images: VariantUpdate_productVariantUpdate_productVariant_images | null;
name: string;