Skip to content

Commit

Permalink
fixup! feat(bindnode): infer links and Any from Go types
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed May 25, 2022
1 parent 1d609bd commit d4915f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node/bindnode/infer.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func inferSchema(typ reflect.Type, level int) schema.Type {
case reflect.String:
return schemaTypeString
case reflect.Struct:
if typ == goTypeCid || typ == goTypeCidLink {
if typ.AssignableTo(goTypeCid) || typ.AssignableTo(goTypeCidLink) {
return schemaTypeLink
}

Expand Down Expand Up @@ -434,10 +434,10 @@ func inferSchema(typ reflect.Type, level int) schema.Type {
defaultTypeSystem.Accumulate(typSchema)
return typSchema
case reflect.Interface:
if typ == goTypeLink {
if typ.AssignableTo(goTypeLink) {
return schemaTypeLink
}
if typ == goTypeNode {
if typ.AssignableTo(goTypeNode) {
return schemaTypeAny
}
panic("bindnode: unable to infer from interface")
Expand Down

0 comments on commit d4915f0

Please sign in to comment.