Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Remove `sku` and `barcode` from Product API

Damian Legawiecdb6f979298e2
diff --git a/api/app/serializers/spree/api/v3/product_serializer.rb b/api/app/serializers/spree/api/v3/product_serializer.rb
index 1c6c0a45a2..c4a1db0ba9 100644
--- a/api/app/serializers/spree/api/v3/product_serializer.rb
+++ b/api/app/serializers/spree/api/v3/product_serializer.rb
@@ -5,7 +5,6 @@ module Spree
# Customer-facing product data with limited fields
class ProductSerializer < BaseSerializer
typelize name: :string, description: 'string | null', slug: :string,
- sku: 'string | null', barcode: 'string | null',
meta_description: 'string | null', meta_keywords: 'string | null',
variant_count: :number,
default_variant_id: :string,
@@ -15,7 +14,7 @@ module Spree
original_price: 'StorePrice',
tags: 'string[]'
- attributes :name, :description, :slug, :sku, :barcode,
+ attributes :name, :description, :slug,
:meta_description, :meta_keywords,
:variant_count,
available_on: :iso8601, created_at: :iso8601, updated_at: :iso8601
diff --git a/api/app/serializers/spree/api/v3/variant_serializer.rb b/api/app/serializers/spree/api/v3/variant_serializer.rb
index 62380c5da6..e5fadc6beb 100644
--- a/api/app/serializers/spree/api/v3/variant_serializer.rb
+++ b/api/app/serializers/spree/api/v3/variant_serializer.rb
@@ -4,7 +4,7 @@ module Spree
# Store API Variant Serializer
# Customer-facing variant data with limited fields
class VariantSerializer < BaseSerializer
- typelize product_id: :string, sku: 'string | null', barcode: 'string | null',
+ typelize product_id: :string, sku: 'string | null',
is_master: :boolean, options_text: :string, track_inventory: :boolean, image_count: :number,
purchasable: :boolean, in_stock: :boolean, backorderable: :boolean,
weight: 'number | null', height: 'number | null', width: 'number | null', depth: 'number | null',
@@ -15,7 +15,7 @@ module Spree
variant.product&.prefix_id
end
- attributes :sku, :barcode, :is_master, :options_text, :track_inventory, :image_count,
+ attributes :sku, :is_master, :options_text, :track_inventory, :image_count,
created_at: :iso8601, updated_at: :iso8601
attribute :purchasable do |variant|
diff --git a/api/spec/serializers/spree/api/v3/product_serializer_spec.rb b/api/spec/serializers/spree/api/v3/product_serializer_spec.rb
index 2581088cde..08894f7745 100644
--- a/api/spec/serializers/spree/api/v3/product_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v3/product_serializer_spec.rb
@@ -15,6 +15,8 @@ RSpec.describe Spree::Api::V3::ProductSerializer do
'slug' => product.slug,
'default_variant_id' => product.default_variant.prefix_id
)
+ expect(subject).not_to have_key('sku')
+ expect(subject).not_to have_key('barcode')
end
it 'includes timestamps' do
diff --git a/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb b/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb
index 7d604235a8..b91f433fb5 100644
--- a/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb
+++ b/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb
@@ -28,6 +28,7 @@ RSpec.describe Spree::Api::V3::VariantSerializer do
expect(subject).not_to have_key('private_metadata')
expect(subject).not_to have_key('total_on_hand')
expect(subject).not_to have_key('deleted_at')
+ expect(subject).not_to have_key('barcode')
end
describe 'price object' do
diff --git a/sdk/src/types/generated/AdminProduct.ts b/sdk/src/types/generated/AdminProduct.ts
index 8a11c68887..7ac5b190e7 100644
--- a/sdk/src/types/generated/AdminProduct.ts
+++ b/sdk/src/types/generated/AdminProduct.ts
@@ -1,4 +1,4 @@
-// Typelizer digest 105fd5df57d6130fb1ac40cc0cc77c68
+// Typelizer digest 90ab74b8f6e407e6c3a08e9b58bfd24e
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {StorePrice, StoreImage, AdminVariant, StoreOptionType, StoreTaxon} from '@/types'
@@ -8,8 +8,6 @@ type AdminProduct = {
name: string;
description: string | null;
slug: string;
- sku: string | null;
- barcode: string | null;
meta_description: string | null;
meta_keywords: string | null;
variant_count: number;
diff --git a/sdk/src/types/generated/AdminVariant.ts b/sdk/src/types/generated/AdminVariant.ts
index 28d106e637..49e7fdda7c 100644
--- a/sdk/src/types/generated/AdminVariant.ts
+++ b/sdk/src/types/generated/AdminVariant.ts
@@ -1,4 +1,4 @@
-// Typelizer digest e8eb7989ec4e6f10f86fc7fca2e85498
+// Typelizer digest f11bb745b5233226e8c325ae5ece6e97
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {StorePrice, StoreImage, StoreOptionValue, AdminPrice} from '@/types'
@@ -7,7 +7,6 @@ type AdminVariant = {
id: string;
product_id: string;
sku: string | null;
- barcode: string | null;
is_master: boolean;
options_text: string;
track_inventory: boolean;
diff --git a/sdk/src/types/generated/StoreProduct.ts b/sdk/src/types/generated/StoreProduct.ts
index 7d90b99a26..495161420a 100644
--- a/sdk/src/types/generated/StoreProduct.ts
+++ b/sdk/src/types/generated/StoreProduct.ts
@@ -1,4 +1,4 @@
-// Typelizer digest cbd70b5850c4c3b28f03bbe28810893a
+// Typelizer digest 3500359bf25409e4d4e7deb376950b65
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {StorePrice, StoreImage, StoreVariant, StoreOptionType, StoreTaxon} from '@/types'
@@ -8,8 +8,6 @@ type StoreProduct = {
name: string;
description: string | null;
slug: string;
- sku: string | null;
- barcode: string | null;
meta_description: string | null;
meta_keywords: string | null;
variant_count: number;
diff --git a/sdk/src/types/generated/StoreVariant.ts b/sdk/src/types/generated/StoreVariant.ts
index 6ff35b2e84..c8e7fc0bae 100644
--- a/sdk/src/types/generated/StoreVariant.ts
+++ b/sdk/src/types/generated/StoreVariant.ts
@@ -1,4 +1,4 @@
-// Typelizer digest bc4f456cedca5c21d10912c352e05bac
+// Typelizer digest f725853757a0590127c7335e3eee37e3
//
// DO NOT MODIFY: This file was automatically generated by Typelizer.
import type {StorePrice, StoreImage, StoreOptionValue} from '@/types'
@@ -7,7 +7,6 @@ type StoreVariant = {
id: string;
product_id: string;
sku: string | null;
- barcode: string | null;
is_master: boolean;
options_text: string;
track_inventory: boolean;