pulumi/pkg/pack/package.go
joeduffy d334ea322b Add custom decoding for MuPack metadata
This adds basic custom decoding for the MuPack metadata section of
the incoming JSON/YAML.  Because of the type discriminated union nature
of the incoming payload, we cannot rely on the simple built-in JSON/YAML
unmarshaling behavior.  Note that for the metadata section -- what is
in this checkin -- we could have, but the IL AST nodes are problematic.
(To know what kind of structure to creat requires inspecting the "kind"
field of the IL.)  We will use a reflection-driven walk of the target
structure plus a weakly typed deserialized map[string]interface{}, as
is fairly customary in Go for scenarios like this (though good libaries
seem to be lacking in this area...).
2017-01-14 07:40:13 -08:00

26 lines
1 KiB
Go

// Copyright 2016 Marapongo, Inc. All rights reserved.
// This package contains the core MuPackage metadata types.
package pack
import (
"github.com/marapongo/mu/pkg/pack/ast"
"github.com/marapongo/mu/pkg/pack/symbols"
)
// Metadata is an informational section describing a package.
type Metadata struct {
Name string `json:"name"` // a required fully qualified name.
Description string `json:"description,omitempty"` // an optional informational description.
Author string `json:"author,omitempty"` // an optional author.
Website string `json:"website,omitempty"` // an optional website for additional info.
License string `json:"license,omitempty"` // an optional license governing this package's usage.
}
// Package is a top-level package definition.
type Package struct {
Metadata
Dependencies *[]symbols.ModuleToken `json:"dependencies,omitempty"` // all of the module dependencies.
Modules *[]ast.Modules `json:"modules,omitempty"` // a collection of top-level modules.
}