jsonschema
jsonschema copied to clipboard
consider API methods supporting io.Reader
passing around io.Readers is broadly supported in the golang ecosystem, but this API only supports []byte as input.
have you considered adding support for taking in io.Readers in the API?
Supporting an interface which is a subset of json.Decoder as input would be more useful. json.NewDecoder can take an io.Reader as input.
See how package github.com/dolmen-go/jsonptr uses jsonptr.JSONDecoder as input for extracting data from JSON documents with jsonptr.Get:
type JSONDecoder interface {
Token() (json.Token, error)
More() bool
Decode(interface{}) error
}
Disclaimer: I'm the author of this jsonptr package.