Skip to content

Commit 7a90a42

Browse files
authored
Merge pull request devfile#102 from yangcao77/update-schema
update schema file to include stackInfo and Versions lists
2 parents dbd6c68 + 7477374 commit 7a90a42

File tree

1 file changed

+97
-23
lines changed

1 file changed

+97
-23
lines changed

index/generator/schema/schema.go

Lines changed: 97 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,85 @@ Sample index file:
99
[
1010
{
1111
"name": "java-maven",
12-
"version": "1.1.0",
1312
"displayName": "Maven Java",
1413
"description": "Upstream Maven and OpenJDK 11",
1514
"type": "stack",
1615
"tags": [
1716
"Java",
1817
"Maven"
1918
],
19+
"architectures": [
20+
"amd64",
21+
"arm64",
22+
"s390x"
23+
],
2024
"projectType": "maven",
2125
"language": "java",
22-
"links": {
23-
"self": "devfile-catalog/java-maven:latest"
24-
},
25-
"resources": [
26-
"devfile.yaml"
27-
],
28-
"starterProjects": [
29-
"springbootproject"
26+
"versions": [
27+
{
28+
"version": "1.1.0",
29+
"schemaVersion": "2.1.0",
30+
"default": true,
31+
"description": "Upstream Maven and OpenJDK 11",
32+
"tags": [
33+
"Java",
34+
"Maven"
35+
],
36+
"architectures": [
37+
"amd64",
38+
"arm64",
39+
"s390x"
40+
],
41+
"links": {
42+
"self": "devfile-catalog/java-maven:1.1.0"
43+
},
44+
"resources": [
45+
"devfile.yaml"
46+
],
47+
"starterProjects": [
48+
"springbootproject"
49+
]
50+
}
3051
]
3152
},
3253
{
33-
"name": "java-openliberty",
34-
"version": "0.5.0",
35-
"displayName": "Open Liberty",
36-
"description": "Java application stack using Open Liberty runtime",
54+
"name": "java-quarkus",
55+
"displayName": "Quarkus Java",
56+
"description": "Quarkus with Java",
3757
"type": "stack",
38-
"projectType": "docker",
39-
"language": "java",
40-
"links": {
41-
"self": "devfile-catalog/java-openliberty:latest"
42-
},
43-
"resources": [
44-
"devfile.yaml"
58+
"tags": [
59+
"Java",
60+
"Quarkus"
61+
],
62+
"architectures": [
63+
"amd64"
4564
],
46-
"starterProjects": [
47-
"user-app"
65+
"projectType": "quarkus",
66+
"language": "java",
67+
"versions": [
68+
{
69+
"version": "1.1.0",
70+
"schemaVersion": "2.0.0",
71+
"default": true,
72+
"description": "Quarkus with Java",
73+
"tags": [
74+
"Java",
75+
"Quarkus"
76+
],
77+
"architectures": [
78+
"amd64"
79+
],
80+
"links": {
81+
"self": "devfile-catalog/java-quarkus:1.1.0"
82+
},
83+
"resources": [
84+
"devfile.yaml"
85+
],
86+
"starterProjects": [
87+
"community",
88+
"redhat-product"
89+
]
90+
}
4891
]
4992
}
5093
]
@@ -68,6 +111,7 @@ resources: []string - The file resources that compose a devfile stack.
68111
starterProjects: string[] - The project templates that can be used in the devfile
69112
git: *git - The information of remote repositories
70113
provider: string - The devfile provider information
114+
versions: []Version - The list of stack versions information
71115
*/
72116

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

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

117163
// Git stores the information of remote repositories
118164
type Git struct {
119-
Remotes map[string]string `yaml:"remotes,omitempty" json:"remotes,omitempty"`
165+
Remotes map[string]string `yaml:"remotes,omitempty" json:"remotes,omitempty"`
166+
Url string `yaml:"url,omitempty" json:"url,omitempty"`
167+
RemoteName string `yaml:"remoteName,omitempty" json:"remoteName,omitempty"`
168+
SubDir string `yaml:"subDir,omitempty" json:"subDir,omitempty"`
169+
Revision string `yaml:"revision,omitempty" json:"revision,omitempty"`
120170
}
121171

122172
// ExtraDevfileEntries is the extraDevfileEntries structure that is used by index component
123173
type ExtraDevfileEntries struct {
124174
Samples []Schema `yaml:"samples,omitempty" json:"samples,omitempty"`
125175
Stacks []Schema `yaml:"stacks,omitempty" json:"stacks,omitempty"`
126176
}
177+
178+
// Version stores the top-level stack information defined within stack.yaml
179+
type StackInfo struct {
180+
Name string `yaml:"name,omitempty" json:"name,omitempty"`
181+
DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
182+
Description string `yaml:"description,omitempty" json:"description,omitempty"`
183+
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
184+
Versions []Version `yaml:"versions,omitempty" json:"versions,omitempty"`
185+
}
186+
187+
// Version stores the information for each stack version
188+
type Version struct {
189+
Version string `yaml:"version,omitempty" json:"version,omitempty"`
190+
SchemaVersion string `yaml:"schemaVersion,omitempty" json:"schemaVersion,omitempty"`
191+
Default bool `yaml:"default,omitempty" json:"default,omitempty"`
192+
Git *Git `yaml:"git,omitempty" json:"git,omitempty"`
193+
Description string `yaml:"description,omitempty" json:"description,omitempty"`
194+
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
195+
Architectures []string `yaml:"architectures,omitempty" json:"architectures,omitempty"`
196+
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
197+
Links map[string]string `yaml:"links,omitempty" json:"links,omitempty"`
198+
Resources []string `yaml:"resources,omitempty" json:"resources,omitempty"`
199+
StarterProjects []string `yaml:"starterProjects,omitempty" json:"starterProjects,omitempty"`
200+
}

0 commit comments

Comments
 (0)