You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the validateObject function to validate DDOs. However, it is currently doing this validation without checking what fields are required by the schema. So for example, the short DDO is unable to pass the validation as there are hardcoded checks for @context and metadata. The validation should only check for fields that are required by the schema. This could also cause problems for other DDO formats from other organisations, or ones added by us in the future.
exportasyncfunctionvalidateObject(obj: Record<string,any>,chainId: number,nftAddress: string): Promise<[boolean,Record<string,string>]>{CORE_LOGGER.logMessage(`Validating object: `+JSON.stringify(obj),true)constextraErrors: Record<string,string>={}if(!('@context'inobj)){extraErrors['@context']='Context is missing.'}if('@context'inobj&&!Array.isArray(obj['@context'])){extraErrors['@context']='Context is not an array.'}if(!('metadata'inobj)){extraErrors.metadata='Metadata is missing or invalid.'};['created','updated'].forEach((attr)=>{if('metadata'inobj&&attrinobj.metadata&&!isIsoFormat(obj.metadata[attr])){extraErrors.metadata=`${attr} is not in ISO format.`}})if(!chainId){extraErrors.chainId='chainId is missing or invalid.'}
...
The text was updated successfully, but these errors were encountered:
We are using the
validateObject
function to validate DDOs. However, it is currently doing this validation without checking what fields are required by the schema. So for example, the short DDO is unable to pass the validation as there are hardcoded checks for@context
andmetadata
. The validation should only check for fields that are required by the schema. This could also cause problems for other DDO formats from other organisations, or ones added by us in the future.The text was updated successfully, but these errors were encountered: