Skip to content

Commit bbe2328

Browse files
committed
spec.go: omitempty fields to be able to do serialization merging
Signed-off-by: Mateusz Gozdek <mgozdek@microsoft.com>
1 parent 6650b98 commit bbe2328

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

docs/spec.schema.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,10 +2007,8 @@
20072007
"required": [
20082008
"name",
20092009
"description",
2010-
"website",
20112010
"version",
2012-
"revision",
2013-
"license"
2011+
"revision"
20142012
],
20152013
"properties": {
20162014
"args": {
@@ -2064,7 +2062,8 @@
20642062
},
20652063
"license": {
20662064
"type": [
2067-
"string"
2065+
"string",
2066+
"null"
20682067
],
20692068
"description": "License is the license of the package."
20702069
},
@@ -2173,7 +2172,8 @@
21732172
},
21742173
"website": {
21752174
"type": [
2176-
"string"
2175+
"string",
2176+
"null"
21772177
],
21782178
"description": "Website is the URL to store in the metadata of the package."
21792179
}

spec.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ import (
1717
// Spec is the specification for a package build.
1818
type Spec struct {
1919
// Name is the name of the package.
20-
Name string `yaml:"name" json:"name" jsonschema:"required"`
20+
Name string `yaml:"name" json:"name,omitempty" jsonschema:"required"`
2121
// Description is a short description of the package.
22-
Description string `yaml:"description" json:"description" jsonschema:"required"`
22+
Description string `yaml:"description" json:"description,omitempty" jsonschema:"required"`
2323
// Website is the URL to store in the metadata of the package.
24-
Website string `yaml:"website" json:"website"`
24+
Website string `yaml:"website" json:"website,omitempty"`
2525

2626
// Version sets the version of the package.
27-
Version string `yaml:"version" json:"version" jsonschema:"required"`
27+
Version string `yaml:"version" json:"version,omitempty" jsonschema:"required"`
2828
// Revision sets the package revision.
2929
// This will generally get merged into the package version when generating the package.
30-
Revision string `yaml:"revision" json:"revision" jsonschema:"required,oneof_type=string;integer"`
30+
Revision string `yaml:"revision" json:"revision,omitempty" jsonschema:"required,oneof_type=string;integer"`
3131

3232
// Marks the package as architecture independent.
3333
// It is up to the package author to ensure that the package is actually architecture independent.
@@ -70,7 +70,7 @@ type Spec struct {
7070
Args map[string]string `yaml:"args,omitempty" json:"args,omitempty"`
7171

7272
// License is the license of the package.
73-
License string `yaml:"license" json:"license"`
73+
License string `yaml:"license" json:"license,omitempty"`
7474
// Vendor is the vendor of the package.
7575
Vendor string `yaml:"vendor,omitempty" json:"vendor,omitempty"`
7676
// Packager is the name of the person,team,company that packaged the package.

0 commit comments

Comments
 (0)