Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/spec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2007,10 +2007,8 @@
"required": [
"name",
"description",
"website",
"version",
"revision",
"license"
"revision"
],
"properties": {
"args": {
Expand Down Expand Up @@ -2064,7 +2062,8 @@
},
"license": {
"type": [
"string"
"string",
"null"
],
"description": "License is the license of the package."
},
Expand Down Expand Up @@ -2173,7 +2172,8 @@
},
"website": {
"type": [
"string"
"string",
"null"
],
"description": "Website is the URL to store in the metadata of the package."
}
Expand Down
12 changes: 6 additions & 6 deletions spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import (
// Spec is the specification for a package build.
type Spec struct {
// Name is the name of the package.
Name string `yaml:"name" json:"name" jsonschema:"required"`
Name string `yaml:"name" json:"name,omitempty" jsonschema:"required"`
// Description is a short description of the package.
Description string `yaml:"description" json:"description" jsonschema:"required"`
Description string `yaml:"description" json:"description,omitempty" jsonschema:"required"`
// Website is the URL to store in the metadata of the package.
Website string `yaml:"website" json:"website"`
Website string `yaml:"website" json:"website,omitempty"`

// Version sets the version of the package.
Version string `yaml:"version" json:"version" jsonschema:"required"`
Version string `yaml:"version" json:"version,omitempty" jsonschema:"required"`
// Revision sets the package revision.
// This will generally get merged into the package version when generating the package.
Revision string `yaml:"revision" json:"revision" jsonschema:"required,oneof_type=string;integer"`
Revision string `yaml:"revision" json:"revision,omitempty" jsonschema:"required,oneof_type=string;integer"`
Comment on lines +20 to +30
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding "omitempty" to fields marked with "jsonschema:"required"" (Name, Description, Version, Revision) creates a potential inconsistency. While this enables the spec merging pattern used in testLinuxSpec, it means that a marshaled Spec with empty required fields will omit those fields from JSON, potentially failing schema validation when these fields are truly required. Consider documenting this design decision or ensuring that validation occurs before/after merging operations to catch missing required fields.

Copilot uses AI. Check for mistakes.

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

// License is the license of the package.
License string `yaml:"license" json:"license"`
License string `yaml:"license" json:"license,omitempty"`
// Vendor is the vendor of the package.
Vendor string `yaml:"vendor,omitempty" json:"vendor,omitempty"`
// Packager is the name of the person,team,company that packaged the package.
Expand Down
Loading