jx/internal/resource/decoder.go
Matthew Rich 5a49359722
Some checks failed
Lint / golangci-lint (push) Failing after 10m8s
Declarative Tests / test (push) Successful in 54s
add encoder/decoder support for json and yaml
add support for jsonschema verification
2024-04-03 09:54:50 -07:00

35 lines
544 B
Go

// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
package resource
import (
"encoding/json"
_ "fmt"
_ "github.com/xeipuuv/gojsonschema"
"gopkg.in/yaml.v3"
"io"
_ "log"
)
//type JSONDecoder json.Decoder
type Decoder interface {
Decode(v any) error
}
func NewDecoder() *Decoder {
return nil
}
func NewJSONDecoder(r io.Reader) Decoder {
return json.NewDecoder(r)
}
func NewYAMLDecoder(r io.Reader) Decoder {
return yaml.NewDecoder(r)
}
func NewProtoBufDecoder(r io.Reader) Decoder {
return nil
}