Skip to content
Pyck docs

You are reading the Dev docs (main @ e991a08). They can differ from the released product.Dev docs, not the release

Switch to LatestLatest

Migration guide: InventoryItem data field

Audience Developer

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.

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
}
  1. Field Removed: The inventoryJSONData field no longer exists on InventoryItem
  2. Database Migration: The inventory_json_data column has been removed from the items table
  3. Data Preserved: All data previously stored in inventoryJSONData has been migrated to the data field

Replace all occurrences of inventoryJSONData with data in your queries.

Before:

query GetInventoryItems {
inventoryItems(first: 10) {
edges {
node {
id
sku
inventoryJSONData
}
}
}
}

After:

query GetInventoryItems {
inventoryItems(first: 10) {
edges {
node {
id
sku
data
}
}
}
}

Update create and update mutations to use data instead of inventoryJSONData.

Before:

mutation CreateItem($input: CreateInventoryItemInput!) {
createInventoryItem(input: $input) {
id
sku
inventoryJSONData
}
}
# Variables
{
"input": {
"sku": "ITEM-001",
"inventoryJSONData": {
"weight": 1.5,
"color": "blue"
}
}
}

After:

mutation CreateItem($input: CreateInventoryItemInput!) {
createInventoryItem(input: $input) {
inventoryItem {
id
sku
data
}
}
}
# Variables
{
"input": {
"sku": "ITEM-001",
"data": {
"weight": 1.5,
"color": "blue"
}
}
}

Update where clauses that filter on JSON data fields.

Before:

query GetItemsByWeight {
inventoryItems(
where: {
inventoryJSONDataHasKey: "weight"
}
) {
edges {
node {
id
sku
inventoryJSONData
}
}
}
}

After:

query GetItemsByWeight {
inventoryItems(
where: {
DataHasKey: "weight"
}
) {
edges {
node {
id
sku
data
}
}
}
}

Update your client code to use the new field name.

Before (JavaScript):

const items = response.data.inventoryItems.edges.map(edge => ({
id: edge.node.id,
sku: edge.node.sku,
customData: edge.node.inventoryJSONData
}));

After (JavaScript):

const items = response.data.inventoryItems.edges.map(edge => ({
id: edge.node.id,
sku: edge.node.sku,
customData: edge.node.data
}));

Before:

query GetItemsWithMetadata {
inventoryItems(
first: 20,
where: {
inventoryJSONDataHasKey: "metadata"
}
) {
edges {
node {
id
sku
inventoryJSONData
createdAt
}
}
totalCount
}
}

After:

query GetItemsWithMetadata {
inventoryItems(
first: 20,
where: {
DataHasKey: "metadata"
}
) {
edges {
node {
id
sku
data
createdAt
}
}
totalCount
}
}

Before:

mutation CreateProductItem {
createInventoryItem(input: {
sku: "PROD-12345",
inventoryJSONData: {
category: "electronics",
manufacturer: "Acme Corp",
warranty: "2 years"
}
}) {
id
sku
inventoryJSONData
}
}

After:

mutation CreateProductItem {
createInventoryItem(input: {
sku: "PROD-12345",
data: {
category: "electronics",
manufacturer: "Acme Corp",
warranty: "2 years"
}
}) {
inventoryItem {
id
sku
data
}
}
}

Before:

mutation UpdateItemData($id: ID!, $newData: Map!) {
updateInventoryItem(id: $id, input: {
inventoryJSONData: $newData
}) {
id
sku
inventoryJSONData
}
}

After:

mutation UpdateItemData($id: ID!, $newData: Map!) {
updateInventoryItem(id: $id, input: {
data: $newData
}) {
inventoryItem {
id
sku
data
}
}
}

Entity types now use the same data field of type Map. Shared mixins across entity types reduce duplication in the schema, and the filter names (DataHasKey, DataContains, etc.) are the same across all entity types.

The following filter fields have been renamed for consistency:

Old Field Name New Field Name
inventoryJSONData Data
inventoryJSONDataHasKey DataHasKey
inventoryJSONDataIn DataIn
inventoryJSONDataContains DataContains

Error: Cannot query field inventoryJSONData on type InventoryItem

Section titled “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:

# Wrong
inventoryItems {
edges {
node {
inventoryJSONData
}
}
}
# Correct
inventoryItems {
edges {
node {
data
}
}
}

Error: Field inventoryJSONDataHasKey is not defined

Section titled “Error: Field inventoryJSONDataHasKey is not defined”

Update your where clause to use the new filter field names:

# Wrong
where: {
inventoryJSONDataHasKey: "category"
}
# Correct
where: {
DataHasKey: "category"
}