Skip to content

Commit

Permalink
Merge pull request devfile#102 from yangcao77/update-schema
Browse files Browse the repository at this point in the history
update schema file to include stackInfo and Versions lists
  • Loading branch information
yangcao77 authored Feb 22, 2022
2 parents dbd6c68 + 7477374 commit 7a90a42
Showing 1 changed file with 97 additions and 23 deletions.
120 changes: 97 additions & 23 deletions index/generator/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,85 @@ Sample index file:
[
{
"name": "java-maven",
"version": "1.1.0",
"displayName": "Maven Java",
"description": "Upstream Maven and OpenJDK 11",
"type": "stack",
"tags": [
"Java",
"Maven"
],
"architectures": [
"amd64",
"arm64",
"s390x"
],
"projectType": "maven",
"language": "java",
"links": {
"self": "devfile-catalog/java-maven:latest"
},
"resources": [
"devfile.yaml"
],
"starterProjects": [
"springbootproject"
"versions": [
{
"version": "1.1.0",
"schemaVersion": "2.1.0",
"default": true,
"description": "Upstream Maven and OpenJDK 11",
"tags": [
"Java",
"Maven"
],
"architectures": [
"amd64",
"arm64",
"s390x"
],
"links": {
"self": "devfile-catalog/java-maven:1.1.0"
},
"resources": [
"devfile.yaml"
],
"starterProjects": [
"springbootproject"
]
}
]
},
{
"name": "java-openliberty",
"version": "0.5.0",
"displayName": "Open Liberty",
"description": "Java application stack using Open Liberty runtime",
"name": "java-quarkus",
"displayName": "Quarkus Java",
"description": "Quarkus with Java",
"type": "stack",
"projectType": "docker",
"language": "java",
"links": {
"self": "devfile-catalog/java-openliberty:latest"
},
"resources": [
"devfile.yaml"
"tags": [
"Java",
"Quarkus"
],
"architectures": [
"amd64"
],
"starterProjects": [
"user-app"
"projectType": "quarkus",
"language": "java",
"versions": [
{
"version": "1.1.0",
"schemaVersion": "2.0.0",
"default": true,
"description": "Quarkus with Java",
"tags": [
"Java",
"Quarkus"
],
"architectures": [
"amd64"
],
"links": {
"self": "devfile-catalog/java-quarkus:1.1.0"
},
"resources": [
"devfile.yaml"
],
"starterProjects": [
"community",
"redhat-product"
]
}
]
}
]
Expand All @@ -68,6 +111,7 @@ resources: []string - The file resources that compose a devfile stack.
starterProjects: string[] - The project templates that can be used in the devfile
git: *git - The information of remote repositories
provider: string - The devfile provider information
versions: []Version - The list of stack versions information
*/

// Schema is the index file schema
Expand All @@ -90,6 +134,7 @@ type Schema struct {
Git *Git `yaml:"git,omitempty" json:"git,omitempty"`
Provider string `yaml:"provider,omitempty" json:"provider,omitempty"`
SupportUrl string `yaml:"supportUrl,omitempty" json:"supportUrl,omitempty"`
Versions []Version `yaml:"versions,omitempty" json:"versions,omitempty"`
}

// DevfileType describes the type of devfile
Expand All @@ -112,15 +157,44 @@ type StarterProject struct {
type Devfile struct {
Meta Schema `yaml:"metadata,omitempty" json:"metadata,omitempty"`
StarterProjects []StarterProject `yaml:"starterProjects,omitempty" json:"starterProjects,omitempty"`
SchemaVersion string `yaml:"schemaVersion,omitempty" json:"schemaVersion,omitempty"`
}

// Git stores the information of remote repositories
type Git struct {
Remotes map[string]string `yaml:"remotes,omitempty" json:"remotes,omitempty"`
Remotes map[string]string `yaml:"remotes,omitempty" json:"remotes,omitempty"`
Url string `yaml:"url,omitempty" json:"url,omitempty"`
RemoteName string `yaml:"remoteName,omitempty" json:"remoteName,omitempty"`
SubDir string `yaml:"subDir,omitempty" json:"subDir,omitempty"`
Revision string `yaml:"revision,omitempty" json:"revision,omitempty"`
}

// ExtraDevfileEntries is the extraDevfileEntries structure that is used by index component
type ExtraDevfileEntries struct {
Samples []Schema `yaml:"samples,omitempty" json:"samples,omitempty"`
Stacks []Schema `yaml:"stacks,omitempty" json:"stacks,omitempty"`
}

// Version stores the top-level stack information defined within stack.yaml
type StackInfo struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
Versions []Version `yaml:"versions,omitempty" json:"versions,omitempty"`
}

// Version stores the information for each stack version
type Version struct {
Version string `yaml:"version,omitempty" json:"version,omitempty"`
SchemaVersion string `yaml:"schemaVersion,omitempty" json:"schemaVersion,omitempty"`
Default bool `yaml:"default,omitempty" json:"default,omitempty"`
Git *Git `yaml:"git,omitempty" json:"git,omitempty"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
Architectures []string `yaml:"architectures,omitempty" json:"architectures,omitempty"`
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
Links map[string]string `yaml:"links,omitempty" json:"links,omitempty"`
Resources []string `yaml:"resources,omitempty" json:"resources,omitempty"`
StarterProjects []string `yaml:"starterProjects,omitempty" json:"starterProjects,omitempty"`
}

0 comments on commit 7a90a42

Please sign in to comment.