Skip to content

JSONParent interface doesn't match it's documentation, nor is useful with jsonschema.Schema #10

Description

@dan-j

Issue

I'm trying to traverse a *jsonschema.Schema using this library and notice that this library declares the following interface:

// JSONParent is an interface that enables tree traversal by listing
// all immediate children of an object
type JSONParent interface {
	// JSONChildren should return all immidiate children of this element
	// with json property names as keys, go types as values
	// Note that implementations on slice-types are expected to convert
	// integers to string keys
	JSONProps() map[string]interface{}
}

Note that the JSONProps() function is actually documented as JSONChildren.

Also, https://github.com/qri-io/jsonschema exposes the JSONChildren() function and not JSONProps().

Do you have a suggested fix?

Two options:

  1. Don't introduce breaking changes and update the documentation here. Then update the jsonschema package to implement both JSONProps() and JSONChildren() (which implements the same behaviour)
  2. Make a breaking change to this repo and change the signature to match the documentation. The only change to jsonschema would be to update go.mod with the latest version.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions