Compare commits

...

1 commit

Author SHA1 Message Date
Tasia Halim 38d9943903 add display name to package 2020-03-27 09:17:32 -07:00
2 changed files with 13 additions and 0 deletions

View file

@ -233,6 +233,14 @@ func (mod *modContext) details(t *schema.ObjectType) *typeDetails {
return details
}
func (mod *modContext) getPackageDisplayName() string {
displayName := mod.pkg.DisplayName
if displayName != "" {
return displayName
}
return mod.pkg.Name
}
type propertyCharacteristics struct {
// input is a flag indicating if the property is an input type.
input bool

View file

@ -254,6 +254,8 @@ type Package struct {
// Name is the unqualified name of the package (e.g. "aws", "azure", "gcp", "kubernetes". "random")
Name string
// DisplayName is the ready-to-display name of the package (e.g. "Microsoft Azure", "Google Cloud").
DisplayName string
// Version is the version of the package.
Version *semver.Version
// Description is the description of the package.
@ -421,6 +423,8 @@ type MetadataSpec struct {
type PackageSpec struct {
// Name is the unqualified name of the package (e.g. "aws", "azure", "gcp", "kubernetes". "random")
Name string `json:"name"`
// DisplayName is the ready-to-display name of the package (e.g. "Microsoft Azure", "Google Cloud").
DisplayName string
// Version is the version of the package. The version must be valid semver.
Version string `json:"version,omitempty"`
// Description is the description of the package.
@ -525,6 +529,7 @@ func ImportSpec(spec PackageSpec) (*Package, error) {
return &Package{
moduleFormat: moduleFormatRegexp,
Name: spec.Name,
DisplayName: spec.DisplayName,
Version: version,
Description: spec.Description,
Keywords: spec.Keywords,