Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Print image inspect metadata fields in PascalCase
Browse files Browse the repository at this point in the history
Prints the metadata fields in PascalCase when calling `app image
inspect` to match the other fields.

Fixed `FromBundle` func comment

Signed-off-by: Nick Adcock <[email protected]>
  • Loading branch information
zappy-shu committed Nov 20, 2019
1 parent 47e1e3a commit db25844
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 44 deletions.
16 changes: 8 additions & 8 deletions e2e/testdata/app-inspect.golden
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"Metadata": {
"version": "1.1.0-beta1",
"name": "simple",
"description": "new fancy webapp with microservices",
"maintainers": [
"Version": "1.1.0-beta1",
"Name": "simple",
"Description": "new fancy webapp with microservices",
"Maintainers": [
{
"name": "John Developer",
"email": "[email protected]"
"Name": "John Developer",
"Email": "[email protected]"
},
{
"name": "Jane Developer",
"email": "[email protected]"
"Name": "Jane Developer",
"Email": "[email protected]"
}
]
},
Expand Down
16 changes: 8 additions & 8 deletions internal/inspect/testdata/inspect-bundle-json.golden
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"Metadata": {
"version": "0.1.0",
"name": "packing",
"description": "hello",
"maintainers": [
"Version": "0.1.0",
"Name": "packing",
"Description": "hello",
"Maintainers": [
{
"name": "dev1",
"email": "[email protected]"
"Name": "dev1",
"Email": "[email protected]"
},
{
"name": "dev2",
"email": "[email protected]"
"Name": "dev2",
"Email": "[email protected]"
}
]
},
Expand Down
12 changes: 6 additions & 6 deletions internal/inspect/testdata/inspect-full-json.golden
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"Metadata": {
"version": "0.1.0",
"name": "myapp",
"description": "some description",
"maintainers": [
"Version": "0.1.0",
"Name": "myapp",
"Description": "some description",
"Maintainers": [
{
"name": "dev",
"email": "[email protected]"
"Name": "dev",
"Email": "[email protected]"
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions internal/inspect/testdata/inspect-no-description-json.golden
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"Metadata": {
"version": "0.1.0",
"name": "myapp",
"maintainers": [
"Version": "0.1.0",
"Name": "myapp",
"Maintainers": [
{
"name": "dev",
"email": "[email protected]"
"Name": "dev",
"Email": "[email protected]"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions internal/inspect/testdata/inspect-no-maintainers-json.golden
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Metadata": {
"version": "0.1.0",
"name": "myapp"
"Version": "0.1.0",
"Name": "myapp"
}
}
12 changes: 6 additions & 6 deletions internal/inspect/testdata/inspect-no-parameters-json.golden
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"Metadata": {
"version": "0.1.0",
"name": "myapp",
"description": "some description",
"maintainers": [
"Version": "0.1.0",
"Name": "myapp",
"Description": "some description",
"Maintainers": [
{
"name": "dev",
"email": "[email protected]"
"Name": "dev",
"Email": "[email protected]"
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions internal/inspect/testdata/inspect-overridden-json.golden
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"Metadata": {
"version": "0.1.0",
"name": "myapp"
"Version": "0.1.0",
"Name": "myapp"
},
"Services": [
{
Expand Down
14 changes: 7 additions & 7 deletions types/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

// Maintainer represents one of the apps's maintainers
type Maintainer struct {
Name string `json:"name"`
Email string `json:"email,omitempty"`
Name string
Email string `json:",omitempty"`
}

// Maintainers is a list of maintainers
Expand All @@ -35,13 +35,13 @@ func (m Maintainer) String() string {

// AppMetadata is the format of the data found inside the metadata.yml file
type AppMetadata struct {
Version string `json:"version"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
Maintainers Maintainers `json:"maintainers,omitempty"`
Version string
Name string
Description string `json:",omitempty"`
Maintainers Maintainers `json:",omitempty"`
}

// Metadata extracts the docker-app metadata from the bundle
// FromBundle extracts the docker-app metadata from the bundle
func FromBundle(bndl *bundle.Bundle) AppMetadata {
meta := AppMetadata{
Name: bndl.Name,
Expand Down

0 comments on commit db25844

Please sign in to comment.