Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Clean useless omitempty tag for mapstructure serialization, as it is …
Browse files Browse the repository at this point in the history
…not handled by mapstructure.

Signed-off-by: Silvin Lubecki <silvin.lubecki@docker.com>
  • Loading branch information
silvin-lubecki committed Mar 22, 2019
1 parent 09d1a2b commit 94cafca
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions pkg/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ type Bundle struct {
Name string `json:"name" mapstructure:"name"`
Version string `json:"version" mapstructure:"version"`
Description string `json:"description" mapstructure:"description"`
Keywords []string `json:"keywords,omitempty" mapstructure:"keywords,omitempty"`
Maintainers []Maintainer `json:"maintainers,omitempty" mapstructure:"maintainers,omitempty"`
Keywords []string `json:"keywords,omitempty" mapstructure:"keywords"`
Maintainers []Maintainer `json:"maintainers,omitempty" mapstructure:"maintainers"`
InvocationImages []InvocationImage `json:"invocationImages" mapstructure:"invocationImages"`
Images map[string]Image `json:"images" mapstructure:"images"`
Actions map[string]Action `json:"actions,omitempty" mapstructure:"actions,omitempty"`
Actions map[string]Action `json:"actions,omitempty" mapstructure:"actions"`
Parameters map[string]ParameterDefinition `json:"parameters" mapstructure:"parameters"`
Credentials map[string]Location `json:"credentials" mapstructure:"credentials"`
}
Expand Down Expand Up @@ -120,7 +120,7 @@ type Action struct {
// Stateless indicates that the action is purely informational, that credentials are not required, and that the runtime should not keep track of its invocation
Stateless bool `json:"stateless,omitempty" mapstructure:"stateless"`
// Description describes the action as a user-readable string
Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
Description string `json:"description,omitempty" mapstructure:"description"`
}

// ValuesOrDefaults returns parameter values or the default parameter values
Expand Down
18 changes: 9 additions & 9 deletions pkg/bundle/parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import (
// ParameterDefinition defines a single parameter for a CNAB bundle
type ParameterDefinition struct {
DataType string `json:"type" mapstructure:"type"`
DefaultValue interface{} `json:"defaultValue,omitempty" mapstructure:"defaultValue,omitempty"`
AllowedValues []interface{} `json:"allowedValues,omitempty" mapstructure:"allowedValues,omitempty"`
DefaultValue interface{} `json:"defaultValue,omitempty" mapstructure:"defaultValue"`
AllowedValues []interface{} `json:"allowedValues,omitempty" mapstructure:"allowedValues"`
Required bool `json:"required" mapstructure:"required"`
MinValue *int `json:"minValue,omitempty" mapstructure:"minValue,omitempty"`
MaxValue *int `json:"maxValue,omitempty" mapstructure:"maxValue,omitempty"`
MinLength *int `json:"minLength,omitempty" mapstructure:"minLength,omitempty"`
MaxLength *int `json:"maxLength,omitempty" mapstructure:"maxLength,omitempty"`
Metadata *ParameterMetadata `json:"metadata,omitempty" mapstructure:"metadata,omitempty"`
Destination *Location `json:"destination,omitempty" mapstructure:"destination,omitempty"`
MinValue *int `json:"minValue,omitempty" mapstructure:"minValue"`
MaxValue *int `json:"maxValue,omitempty" mapstructure:"maxValue"`
MinLength *int `json:"minLength,omitempty" mapstructure:"minLength"`
MaxLength *int `json:"maxLength,omitempty" mapstructure:"maxLength"`
Metadata *ParameterMetadata `json:"metadata,omitempty" mapstructure:"metadata"`
Destination *Location `json:"destination,omitemtpty" mapstructure:"destination"`
ApplyTo []string `json:"apply-to,omitempty" mapstructure:"apply-to,omitempty"`
}

// ParameterMetadata contains metadata for a parameter definition.
type ParameterMetadata struct {
Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
Description string `json:"description,omitempty" mapstructure:"description"`
}

// ValidateParameterValue checks whether a value is valid as the value of
Expand Down
16 changes: 8 additions & 8 deletions pkg/duffle/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
type Manifest struct {
Name string `json:"name" mapstructure:"name"`
Version string `json:"version" mapstructure:"version"`
Description string `json:"description,omitempty" mapstructure:"description,omitempty"`
Keywords []string `json:"keywords,omitempty" mapstructure:"keywords,omitempty"`
Maintainers []bundle.Maintainer `json:"maintainers,omitempty" mapstructure:"maintainers,omitempty"`
InvocationImages map[string]*InvocationImage `json:"invocationImages,omitempty" mapstructure:"invocationImages,omitempty"`
Images map[string]bundle.Image `json:"images,omitempty" mapstructure:"images,omitempty"`
Actions map[string]bundle.Action `json:"actions,omitempty" mapstructure:"actions,omitempty"`
Parameters map[string]bundle.ParameterDefinition `json:"parameters,omitempty" mapstructure:"parameters,omitempty"`
Credentials map[string]bundle.Location `json:"credentials,omitempty" mapstructure:"credentials,omitempty"`
Description string `json:"description,omitempty" mapstructure:"description"`
Keywords []string `json:"keywords,omitempty" mapstructure:"keywords"`
Maintainers []bundle.Maintainer `json:"maintainers,omitempty" mapstructure:"maintainers"`
InvocationImages map[string]*InvocationImage `json:"invocationImages,omitempty" mapstructure:"invocationImages"`
Images map[string]bundle.Image `json:"images,omitempty" mapstructure:"images"`
Actions map[string]bundle.Action `json:"actions,omitempty" mapstructure:"actions"`
Parameters map[string]bundle.ParameterDefinition `json:"parameters,omitempty" mapstructure:"parameters"`
Credentials map[string]bundle.Location `json:"credentials,omitempty" mapstructure:"credentials"`
}

// InvocationImage represents an invocation image component of a CNAB bundle
Expand Down

0 comments on commit 94cafca

Please sign in to comment.