InventoryItem Data Field
Migration guide for the breaking change from inventoryJSONData to the unified data field
Audience: Programmer
Overview
This guide covers a breaking change in the pyck GraphQL API where the inventoryJSONData field has been removed from the InventoryItem type. This field has been replaced with the unified data field that is now available across all entity types through the shared DataMixin.
What Changed
Before: InventoryItem had a separate inventoryJSONData field for storing custom JSON data.
type InventoryItem {
id: ID!
sku: String!
inventoryJSONData: Map # Removed
# ... other fields
}After: InventoryItem uses the unified data field (type Map).
type InventoryItem implements NodeInventory {
id: ID!
sku: String!
data: Map
# ... other fields
}Breaking Changes
Field Removed: The
inventoryJSONDatafield no longer exists onInventoryItemDatabase Migration: The
inventory_json_datacolumn has been removed from the items tableData Preserved: All data previously stored in
inventoryJSONDatahas been migrated to thedatafield
Migration Steps
Step 1: Update GraphQL Queries
Replace all occurrences of inventoryJSONData with data in your queries.
Before:
After:
Step 2: Update Mutations
Update create and update mutations to use data instead of inventoryJSONData.
Before:
After:
Step 3: Update Filter Queries
Update where clauses that filter on JSON data fields.
Before:
After:
Step 4: Update Client Code
Update your client code to use the new field name.
Before (JavaScript):
After (JavaScript):
Complete Migration Examples
Example 1: Query with Custom Data
Before:
After:
Example 2: Create Item with Custom Data
Before:
After:
Example 3: Update Item Custom Data
Before:
After:
Benefits of This Change
Consistency: Entity types now use the same
datafield of typeMapSimplified Schema: Reduces duplication by using shared mixins across entity types
Unified Filtering: Consistent filter names (
dataHasKey,dataContains, etc.) across all entity types
Filter Input Changes
The following filter fields have been renamed for consistency:
inventoryJSONData
data
inventoryJSONDataHasKey
dataHasKey
inventoryJSONDataIn
dataIn
inventoryJSONDataContains
dataContains
Troubleshooting
Error: Cannot query field "inventoryJSONData" on type "InventoryItem"
This error indicates you are still using the old field name. Update your query to use data:
Error: Field "inventoryJSONDataHasKey" is not defined
Update your where clause to use the new filter field names:
Related Documentation
Last updated
Was this helpful?
