mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
fix: jsonschema
very hacky, fixes #3238 for good refs https://github.com/invopop/jsonschema/issues/26 Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
parent
aa12ad014e
commit
ce264f1fca
@ -27,6 +27,7 @@ func newSchemaCmd() *schemaCmd {
|
||||
Args: cobra.NoArgs,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
schema := jsonschema.Reflect(&config.Project{})
|
||||
schema.Definitions["FileInfo"] = jsonschema.Reflect(&config.FileInfo{})
|
||||
schema.Description = "goreleaser configuration definition file"
|
||||
bts, err := json.MarshalIndent(schema, " ", " ")
|
||||
if err != nil {
|
||||
|
@ -427,18 +427,16 @@ type FileInfo struct {
|
||||
MTime time.Time `yaml:"mtime,omitempty" json:"mtime,omitempty"`
|
||||
}
|
||||
|
||||
// type alias to prevent stack overflow
|
||||
type fileAlias File
|
||||
|
||||
// UnmarshalYAML is a custom unmarshaler that wraps strings in arrays.
|
||||
func (f *File) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
type t File
|
||||
var str string
|
||||
if err := unmarshal(&str); err == nil {
|
||||
*f = File{Source: str}
|
||||
return nil
|
||||
}
|
||||
|
||||
var file fileAlias
|
||||
var file t
|
||||
if err := unmarshal(&file); err != nil {
|
||||
return err
|
||||
}
|
||||
|
26
www/docs/static/schema.json
generated
vendored
26
www/docs/static/schema.json
generated
vendored
@ -731,6 +731,32 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"FileInfo": {
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://github.com/goreleaser/goreleaser/pkg/config/file-info",
|
||||
"$ref": "#/$defs/FileInfo",
|
||||
"$defs": {
|
||||
"FileInfo": {
|
||||
"properties": {
|
||||
"owner": {
|
||||
"type": "string"
|
||||
},
|
||||
"group": {
|
||||
"type": "string"
|
||||
},
|
||||
"mode": {
|
||||
"type": "integer"
|
||||
},
|
||||
"mtime": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false,
|
||||
"type": "object"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Filters": {
|
||||
"properties": {
|
||||
"exclude": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user