Skip to content

Commit

Permalink
More accurate name for structure that contains easy access to prototy…
Browse files Browse the repository at this point in the history
…pes.

This is technically a breaking change, as it's an exported name,
but I don't think there are references to this value outside this repo
to date.
  • Loading branch information
warpfork committed Dec 14, 2022
1 parent 39818c1 commit c68ba53
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions node/bindnode/fuzz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func FuzzBindnodeViaDagCBOR(f *testing.F) {
if err != nil {
f.Fatal(err)
}
schemaNode := bindnode.Wrap(schemaDMT, schemadmt.Type.Schema.Type())
schemaNode := bindnode.Wrap(schemaDMT, schemadmt.Prototypes.Schema.Type())
schemaDagCBOR := marshalDagCBOR(f, schemaNode.Representation())

nodeBuilder := basicnode.Prototype.Any.NewBuilder()
Expand Down Expand Up @@ -178,7 +178,7 @@ func FuzzBindnodeViaDagCBOR(f *testing.F) {
}
}
f.Fuzz(func(t *testing.T, schemaDagCBOR, nodeDagCBOR []byte) {
schemaBuilder := schemadmt.Type.Schema.Representation().NewBuilder()
schemaBuilder := schemadmt.Prototypes.Schema.Representation().NewBuilder()

if err := dagcbor.Decode(schemaBuilder, bytes.NewReader(schemaDagCBOR)); err != nil {
t.Skipf("invalid schema-schema dag-cbor: %v", err)
Expand Down
6 changes: 3 additions & 3 deletions schema/dmt/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ func ConcatenateSchemas(a, b *Schema) *Schema {
// The joy of having an intermediate form that's just regular data model:
// we can implement this by simply using data model "copy" operations,
// and the result is correct.
nb := Type.Schema.NewBuilder()
if err := datamodel.Copy(bindnode.Wrap(a, Type.Schema.Type()), nb); err != nil {
nb := Prototypes.Schema.NewBuilder()
if err := datamodel.Copy(bindnode.Wrap(a, Prototypes.Schema.Type()), nb); err != nil {
panic(err)
}
if err := datamodel.Copy(bindnode.Wrap(b, Type.Schema.Type()), nb); err != nil {
if err := datamodel.Copy(bindnode.Wrap(b, Prototypes.Schema.Type()), nb); err != nil {
panic(err)
}
return bindnode.Unwrap(nb.Build()).(*Schema)
Expand Down
2 changes: 1 addition & 1 deletion schema/dmt/roundtrip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func testRoundtrip(t *testing.T, want string, updateFn func(string)) {

crre := regexp.MustCompile(`\r?\n`)
want = crre.ReplaceAllString(want, "\n")
nb := schemadmt.Type.Schema.Representation().NewBuilder()
nb := schemadmt.Prototypes.Schema.Representation().NewBuilder()
err := ipldjson.Decode(nb, strings.NewReader(want))
qt.Assert(t, err, qt.IsNil)
node := nb.Build().(schema.TypedNode)
Expand Down
4 changes: 2 additions & 2 deletions schema/dmt/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// This schema follows https://ipld.io/specs/schemas/schema-schema.ipldsch.

var Type struct {
var Prototypes struct {
Schema schema.TypedPrototype
}

Expand Down Expand Up @@ -435,7 +435,7 @@ func init() {

TypeSystem = ts

Type.Schema = bindnode.Prototype(
Prototypes.Schema = bindnode.Prototype(
(*Schema)(nil),
TypeSystem.TypeByName("Schema"),
)
Expand Down
2 changes: 1 addition & 1 deletion schema/dsl/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func testParse(t *testing.T, inSchema, inJSON string, updateFn func(string)) {
// Ensure we can encode the schema as the json codec,
// and that it results in the same bytes as the ipldsch.json file.
{
node := bindnode.Wrap(sch, schemadmt.Type.Schema.Type())
node := bindnode.Wrap(sch, schemadmt.Prototypes.Schema.Type())

var buf bytes.Buffer
err := ipldjson.Encode(node.Representation(), &buf)
Expand Down

0 comments on commit c68ba53

Please sign in to comment.