mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-28 04:44:34 +02:00
feat: update jsonschema library (#3159)
* feat: update jsonschema library Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com> * fix: test Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
0f128690a0
commit
ad3c6fdcdd
@ -6,8 +6,8 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/alecthomas/jsonschema"
|
||||
"github.com/goreleaser/goreleaser/pkg/config"
|
||||
"github.com/invopop/jsonschema"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
@ -21,5 +21,5 @@ func TestGenerateSchema(t *testing.T) {
|
||||
|
||||
schema := map[string]interface{}{}
|
||||
require.NoError(t, json.NewDecoder(outFile).Decode(&schema))
|
||||
require.Equal(t, "http://json-schema.org/draft-04/schema#", schema["$schema"].(string))
|
||||
require.Equal(t, "http://json-schema.org/draft/2020-12/schema", schema["$schema"].(string))
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -6,7 +6,6 @@ require (
|
||||
code.gitea.io/sdk/gitea v0.15.1
|
||||
github.com/DisgoOrg/disgohook v1.4.4
|
||||
github.com/Masterminds/semver/v3 v3.1.1
|
||||
github.com/alecthomas/jsonschema v0.0.0-20211209230136-e2b41affa5c1
|
||||
github.com/apex/log v1.9.0
|
||||
github.com/atc0005/go-teams-notify/v2 v2.6.1
|
||||
github.com/caarlos0/ctrlc v1.0.0
|
||||
@ -23,6 +22,7 @@ require (
|
||||
github.com/goreleaser/fileglob v1.3.0
|
||||
github.com/goreleaser/nfpm/v2 v2.15.1
|
||||
github.com/imdario/mergo v0.3.13
|
||||
github.com/invopop/jsonschema v0.4.0
|
||||
github.com/jarcoal/httpmock v1.2.0
|
||||
github.com/klauspost/pgzip v1.2.5
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
|
4
go.sum
4
go.sum
@ -148,8 +148,6 @@ github.com/ProtonMail/gopenpgp/v2 v2.2.2 h1:u2m7xt+CZWj88qK1UUNBoXeJCFJwJCZ/Ff4y
|
||||
github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk=
|
||||
github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/alecthomas/jsonschema v0.0.0-20211209230136-e2b41affa5c1 h1:6mZ7MG/flSahicBVy4GKlWI+dzoR5rgnm7H8e17TAio=
|
||||
github.com/alecthomas/jsonschema v0.0.0-20211209230136-e2b41affa5c1/go.mod h1:/n6+1/DWPltRLWL/VKyUxg6tzsl5kHUCcraimt4vr60=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
@ -479,6 +477,8 @@ github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
||||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
||||
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
|
||||
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
|
||||
github.com/invopop/jsonschema v0.4.0 h1:Yuy/unfgCnfV5Wl7H0HgFufp/rlurqPOOuacqyByrws=
|
||||
github.com/invopop/jsonschema v0.4.0/go.mod h1:O9uiLokuu0+MGFlyiaqtWxwqJm41/+8Nj0lD7A36YH0=
|
||||
github.com/jarcoal/httpmock v1.2.0 h1:gSvTxxFR/MEMfsGrvRbdfpRUMBStovlSRLw0Ep1bwwc=
|
||||
github.com/jarcoal/httpmock v1.2.0/go.mod h1:oCoTsnAz4+UoOUIf5lJOWV2QQIW5UoeUI6aM2YnWAZk=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
|
@ -10,11 +10,10 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alecthomas/jsonschema"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/goreleaser/goreleaser/internal/yaml"
|
||||
"github.com/goreleaser/nfpm/v2/files"
|
||||
"github.com/invopop/jsonschema"
|
||||
)
|
||||
|
||||
// GitHubURLs holds the URLs to be used when using github enterprise.
|
||||
@ -108,17 +107,17 @@ func (a *HomebrewDependency) UnmarshalYAML(unmarshal func(interface{}) error) er
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a HomebrewDependency) JSONSchemaType() *jsonschema.Type {
|
||||
func (a HomebrewDependency) JSONSchema() *jsonschema.Schema {
|
||||
reflector := jsonschema.Reflector{
|
||||
ExpandedStruct: true,
|
||||
}
|
||||
schema := reflector.Reflect(&homebrewDependency{})
|
||||
return &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{
|
||||
{
|
||||
Type: "string",
|
||||
},
|
||||
schema.Type,
|
||||
schema,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -264,13 +263,13 @@ func (a *StringArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a StringArray) JSONSchemaType() *jsonschema.Type {
|
||||
return &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{{
|
||||
func (a StringArray) JSONSchema() *jsonschema.Schema {
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{{
|
||||
Type: "string",
|
||||
}, {
|
||||
Type: "array",
|
||||
Items: &jsonschema.Type{
|
||||
Items: &jsonschema.Schema{
|
||||
Type: "string",
|
||||
},
|
||||
}},
|
||||
@ -295,13 +294,13 @@ func (a *FlagArray) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a FlagArray) JSONSchemaType() *jsonschema.Type {
|
||||
return &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{{
|
||||
func (a FlagArray) JSONSchema() *jsonschema.Schema {
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{{
|
||||
Type: "string",
|
||||
}, {
|
||||
Type: "array",
|
||||
Items: &jsonschema.Type{
|
||||
Items: &jsonschema.Schema{
|
||||
Type: "string",
|
||||
},
|
||||
}},
|
||||
@ -379,24 +378,6 @@ func (bhc *Hooks) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bhc Hooks) JSONSchemaType() *jsonschema.Type {
|
||||
type t Hooks
|
||||
reflector := jsonschema.Reflector{
|
||||
ExpandedStruct: true,
|
||||
}
|
||||
schema := reflector.Reflect(&t{})
|
||||
return &jsonschema.Type{
|
||||
Items: &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{
|
||||
{
|
||||
Type: "string",
|
||||
},
|
||||
schema.Type,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
type Hook struct {
|
||||
Dir string `yaml:"dir,omitempty"`
|
||||
Cmd string `yaml:"cmd,omitempty"`
|
||||
@ -421,18 +402,18 @@ func (bh *Hook) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (bh Hook) JSONSchemaType() *jsonschema.Type {
|
||||
func (bh Hook) JSONSchema() *jsonschema.Schema {
|
||||
type t Hook
|
||||
reflector := jsonschema.Reflector{
|
||||
ExpandedStruct: true,
|
||||
}
|
||||
schema := reflector.Reflect(&t{})
|
||||
return &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{
|
||||
{
|
||||
Type: "string",
|
||||
},
|
||||
schema.Type,
|
||||
schema,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -478,21 +459,21 @@ func (f *File) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f File) JSONSchemaType() *jsonschema.Type {
|
||||
func (f File) JSONSchema() *jsonschema.Schema {
|
||||
type t File
|
||||
reflector := jsonschema.Reflector{
|
||||
ExpandedStruct: true,
|
||||
}
|
||||
schema := reflector.Reflect(&t{})
|
||||
// jsonschema would just refer to FileInfo in the definition. It doesn't get included there, as we override the
|
||||
// generated schema with JSONSchemaType here. So we need to include it directly in the schema of File.
|
||||
// generated schema with JSONSchema here. So we need to include it directly in the schema of File.
|
||||
schema.Properties.Set("info", reflector.Reflect(&FileInfo{}).Type)
|
||||
return &jsonschema.Type{
|
||||
OneOf: []*jsonschema.Type{
|
||||
return &jsonschema.Schema{
|
||||
OneOf: []*jsonschema.Schema{
|
||||
{
|
||||
Type: "string",
|
||||
},
|
||||
schema.Type,
|
||||
schema,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
578
www/docs/static/schema.json
generated
vendored
578
www/docs/static/schema.json
generated
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user