usdchecker doesn't detect authored values whose type doesn't match the attribute's declared typeName
A .usdc can contain an attribute declared token[] whose authored value is actually a VtArray<std::string>. usdchecker reports Success!, UsdAttribute::Get() returns the VtStringArray as it is, and Get<VtTokenArray>() fails. Converting to .usda hides the problem, because the text parser casts the value back to the declared type.
We're not entirely sure where this is coming from, but we've now had to help a few customers with problematic assets like this.
This is similar in spirit to 9abcb8119 ("Fix attribute types in USD tests based on usdchecker reports of MismatchedPropertyType") and ShaderSdrCompliance's TestUsdShadeShaderPropertyCompliance test. However, that check, like AttributeTypeMismatch, only compares declared types, not the authored value against the declaration.
Steps to Reproduce
from pxr import Sdf, Vt
layer = Sdf.Layer.CreateNew('tokenArrayHoldsStrings.usdc')
layer.defaultPrim = 'Prim'
layer.pseudoRoot.SetInfo('upAxis', 'Y')
layer.pseudoRoot.SetInfo('metersPerUnit', 1.0)
prim = Sdf.CreatePrimInLayer(layer, '/Prim')
prim.specifier = Sdf.SpecifierDef
attr = Sdf.AttributeSpec(prim, 'names', Sdf.ValueTypeNames.TokenArray)
attr.SetInfo('default', Vt.StringArray(['a', 'b'])) # bypasses the cast
layer.Save()Then usdchecker tokenArrayHoldsStrings.usdc prints Success!, and Get() on /Prim.names (a token[]) returns a Vt.StringArray.
Suggested fix
Pull Request for this is incoming
Add a core validator (e.g. usdValidation:AttributeValueTypeMismatch) that checks each spec's default value and time samples.
Source: PixarAnimationStudios/OpenUSD