-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reference resolution #47
Comments
|
@butenkor How about |
#47: Add check for null/empty new custom type id.
Do you also have customFields or customAttributes in mind, that are of type reference? Not all referenceable resources have static identifiers:
|
Thanks @ValeSauer for pointing that out 😊 I have been investigating it. And actually the library will sync these field types:
But it will actually fail to sync custom fields of a field type: |
Description
Some resources have references to other resources like supply channels on inventory entries or custom types on categories. The sync will always use the
key
to identify the referenced resources. This is becauseTo better describe the issue, I will use supply channels on inventory entries as an example.
Currently, for the two scenarios:
1. Syncing inventory entries from a data feed (XML, CSV)
In order for the sync to be able to access this key, it needs to be accessible in one of the following ways:
Reference.of("Channel", "keyValue");
2. Syncing inventory entries from another CTP project.
In order for the sync to be able to access this key, it needs to be accessible in only one way:
The problem with the current approach is:-
Wrong channel creation
In the first scenario, if ensureChannel is set to true, the inventory is not reference expanded and the key is not set in the id field, then the sync will see this as an Inventory Entry without a Channel and thus will wrongly create a new one.
In the second scenario, if ensureChannel is set to true and the reference is not expanded, then the sync will see this as an Inventory Entry without a Channel and thus will wrongly create a new one.
Proposed Solution
For resources that have references to other resources on them, for example InventoryEntry has
Custom
which references aType
resource andsupplyChannel
which references aChannel
resource.This would be input in the library in a wrapper which has the
InventoryEntryDraft
, thesupplyChannelKey
andcustomTypeKey
. Let's say this wrapper is calledCustomInventoryEntry
(open for better naming proposalsThe user of the library should care how to provide these keys.
If the key is not set (
null
), then the library will consider this InventoryEntry without a Channel and will not create one for it. Even if ensureChannel is set.If the key is set, the library will check if this channel exists, if it doesn't and
ensureChannel
is true, it will create this Channel.FYI: @JakubChrobak @butenkor @piobra
The text was updated successfully, but these errors were encountered: