Skip to content

Commit aacd362

Browse files
committed
fix(schema): handle parsing of "listpairs" in the DSL
Ref: ipld/ipld#281
1 parent 9f519f1 commit aacd362

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

schema/dmt/compile.go

+2
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,8 @@ func spawnType(ts *schema.TypeSystem, name schema.TypeName, defn TypeDefn) (sche
277277
return nil, fmt.Errorf("stringjoin has empty join value")
278278
}
279279
repr = schema.SpawnStructRepresentationStringjoin(join)
280+
case typ.Representation.StructRepresentation_Listpairs != nil:
281+
repr = schema.SpawnStructRepresentationListPairs()
280282
default:
281283
return nil, fmt.Errorf("TODO: support other struct repr in schema package")
282284
}

schema/dsl/parse.go

+3
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ func (p *parser) typeStruct() (*dmt.TypeDefnStruct, error) {
467467
Join: join,
468468
}
469469
return defn, nil
470+
case "listpairs":
471+
defn.Representation.StructRepresentation_Listpairs = &dmt.StructRepresentation_Listpairs{}
472+
return defn, nil
470473
default:
471474
return nil, p.errf("unknown struct repr: %q", reprName)
472475
}

0 commit comments

Comments
 (0)