Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Make `id` a required argument for `mediaById` and `imageById` (#18580)
Patryk Zawadzki68e80f40e6a4
diff --git a/saleor/graphql/product/types/products.py b/saleor/graphql/product/types/products.pyindex 176029e56b..b589f59234 100644--- a/saleor/graphql/product/types/products.py+++ b/saleor/graphql/product/types/products.py@@ -1000,12 +1000,16 @@ class Product(ChannelContextType[models.Product]):)media_by_id = graphene.Field(lambda: ProductMedia,- id=graphene.Argument(graphene.ID, description="ID of a product media."),+ id=graphene.Argument(+ graphene.ID, description="ID of a product media.", required=True+ ),description="Get a single product media by ID.",)image_by_id = graphene.Field(lambda: ProductImage,- id=graphene.Argument(graphene.ID, description="ID of a product image."),+ id=graphene.Argument(+ graphene.ID, description="ID of a product image.", required=True+ ),description="Get a single product image by ID.",deprecation_reason="Use the `mediaById` field instead.",)diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 5c868741e1..80c1748686 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -5697,13 +5697,13 @@ type Product implements Node & ObjectWithMetadata & ObjectWithAttributes @doc(ca"""Get a single product media by ID."""mediaById("""ID of a product media."""- id: ID+ id: ID!): ProductMedia"""Get a single product image by ID."""imageById("""ID of a product image."""- id: ID+ id: ID!): ProductImage @deprecated(reason: "Use the `mediaById` field instead.")"""Get a single variant by SKU or ID."""