Skip to content

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

Mark type, slug, name fields on Attribute non nullable in schema (#18683)

Lukasz Ostrowski554a0d4749c4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c25548af0b..c78b409f64 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ All notable, unreleased changes to this project will be documented in this file.
### GraphQL API
- Gift cards support as payment method within Transaction API (read more in the [docs](https://docs.saleor.io/developer/gift-cards#using-gift-cards-in-checkout)).
+- `Attribute` fields `name`, `slug` and `type` are now non-nullable in schema.
### Webhooks
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.py
index fdd7886708..c4ee131d23 100644
--- a/saleor/graphql/attribute/types.py
+++ b/saleor/graphql/attribute/types.py
@@ -293,9 +293,9 @@ class Attribute(ChannelContextType[models.Attribute]):
),
)
- name = graphene.String(description=AttributeDescriptions.NAME)
- slug = graphene.String(description=AttributeDescriptions.SLUG)
- type = AttributeTypeEnum(description=AttributeDescriptions.TYPE)
+ name = graphene.String(description=AttributeDescriptions.NAME, required=True)
+ slug = graphene.String(description=AttributeDescriptions.SLUG, required=True)
+ type = AttributeTypeEnum(description=AttributeDescriptions.TYPE, required=True)
unit = MeasurementUnitsEnum(description=AttributeDescriptions.UNIT)
choices = FilterConnectionField(
AttributeValueCountableConnection,
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 57b0fbc4ec..0bb53f1681 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -5894,13 +5894,13 @@ type Attribute implements Node & ObjectWithMetadata @doc(category: "Attributes")
): [ReferenceType!]
"""Name of an attribute displayed in the interface."""
- name: String
+ name: String!
"""Internal representation of an attribute name."""
- slug: String
+ slug: String!
"""The attribute type."""
- type: AttributeTypeEnum
+ type: AttributeTypeEnum!
"""The unit of attribute values."""
unit: MeasurementUnitsEnum