Expand my Community achievements bar.

SOLVED

Descriptor Deprecated | How to specific a field in "xdm:sourceProperty" when it is part of an array

Avatar

Level 3

Hi,

 

I like to create a deprecated descriptor for a schema field "runId". This field is part of an array in the schema. Below is the body of the POST Create a descriptor request:

{
"@type": "xdm:descriptorDeprecated",
"xdm:sourceSchema": "{{SCHEMA_ID}}",
"xdm:sourceVersion": 1.1,
"xdm:sourceProperty": "/{{tenantId}}/modelScores/runId"
}
 
I am getting below error:
{
"title": "Descriptor validation error",
"status": 400,
"report": {
"registryRequestId": "488911d5-1896-481b-8574-a1742815e657",
"timestamp": "08-29-2024 08:50:17",
"detailed-message": "The path /_xyz/[modelScores/runId] defined in xdm:sourceProperty could not be found in the source schema https://ns.adobe.com/xyz/schemas/7b0f03af9bd93b69029123456789abcd234.",
"sub-errors": []
},
"detail": "The path /_xyz/[modelScores/runId] defined in xdm:sourceProperty could not be found in the source schema https://ns.adobe.com/dsg/schemas/7b0f03af9bd93b69029123456789abcd234."
}
 
Here the field runId is part of a schema where modelScores is an array object. Any idea how can we specify the path of an array field in property "xdm:sourceProperty"?
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @Prateek-Garg 

You could try the following:

 

{ "@type": "xdm:descriptorDeprecated",

"xdm:sourceSchema": "{{SCHEMA_ID}}",

"xdm:sourceVersion": 1.1,

"xdm:sourceProperty": "/modelScores[*]/runId" }

 

I read some docs stating this:


--When dealing with arrays in AEP schemas, the path notation often requires the use of an asterisk * to indicate that you are referring to an element within the array.

 

--For fields inside an array, you typically need to specify the array element using the [*] notation. This is used to denote that the field is within any item of the array.

 

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Prateek-Garg , Try using something like xdm:sourceProperty": "/{{tenantId}}/modelScores/[0]/runId.

 

[0] in the path specifies the first element (index 0) within the modelScores array. You can replace [0] with the specific index of the element containing the runId field if your array has multiple elements.

Avatar

Correct answer by
Community Advisor

Hi @Prateek-Garg 

You could try the following:

 

{ "@type": "xdm:descriptorDeprecated",

"xdm:sourceSchema": "{{SCHEMA_ID}}",

"xdm:sourceVersion": 1.1,

"xdm:sourceProperty": "/modelScores[*]/runId" }

 

I read some docs stating this:


--When dealing with arrays in AEP schemas, the path notation often requires the use of an asterisk * to indicate that you are referring to an element within the array.

 

--For fields inside an array, you typically need to specify the array element using the [*] notation. This is used to denote that the field is within any item of the array.

 

Avatar

Level 3

Thanks Dave. It worked. I used [*] in the code and it is accepted. Appreciate your help on this Dave.