2023-04-24 20:52:12 +02:00
|
|
|
package schema
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/qri-io/jsonschema"
|
|
|
|
)
|
|
|
|
|
2023-06-24 01:53:56 +02:00
|
|
|
type Schema = jsonschema.Schema
|
|
|
|
|
|
|
|
func Parse(data []byte) (*Schema, error) {
|
|
|
|
var schema Schema
|
2023-04-24 20:52:12 +02:00
|
|
|
if err := json.Unmarshal(data, &schema); err != nil {
|
|
|
|
return nil, errors.WithStack(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return &schema, nil
|
|
|
|
}
|