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 7b9cc26
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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

0 comments on commit 7b9cc26

Please sign in to comment.