PR feedback

This commit is contained in:
Luke Hoban 2020-03-06 15:17:11 -08:00 committed by Pat Gavlin
parent 3d07de0535
commit 2a35a7283a
2 changed files with 4 additions and 1 deletions

View file

@ -361,6 +361,9 @@ func UnmarshalPropertyValue(v *structpb.Value, opts MarshalOptions) (*resource.P
if !ok {
return nil, errors.New("malformed RPC resource: missing urn")
}
if !urn.IsString() {
return nil, errors.New("malformed RPC resource: urn not a string")
}
r := resource.NewResourceProperty(resource.Resource{Urn: urn})
return &r, nil
default:

View file

@ -506,8 +506,8 @@ export function deserializeProperty(prop: any): any {
value: deserializeProperty(prop["value"]),
};
case specialResourceSig:
// Deserialize the resource into a live Resource reference
const urn = prop["urn"];
// If this value is a URN, create a proxy wrapper around it.
const urnParts = urn.split("::");
const qualifiedType = urnParts[2];
const type = qualifiedType.split("$").pop()!;