Skip to content

Commit a313872

Browse files
Remove plugins from the Devfile schema (#333)
* Remove plugins from devfile schema by... - adding an option in the jsonschema generator to allow skipping Plugin union members - setting this option to true on the Devfile jsonschema annotation. Signed-off-by: David Festal <[email protected]> * Run the fixed generator ... ... to generate devfile schemas without `plugin` components in both the devfile main body and parent overrides Signed-off-by: David Festal <[email protected]> * Update samples and tests for removing plugin Signed-off-by: Maysun J Faisal <[email protected]> Co-authored-by: Maysun J Faisal <[email protected]>
1 parent 1f33556 commit a313872

21 files changed

+17
-2823
lines changed

generator/schemas/gen.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ import (
3535
// GenerateJSONSchema drives whether a Json schema should be generated from this GO Struct type
3636
type GenerateJSONSchema struct {
3737

38-
// OmitCustomUnionMembers indicates that the Json schema gnerated from this type should omit Custom union members.
38+
// OmitCustomUnionMembers indicates that the Json schema generated from this type should omit Custom union members.
3939
OmitCustomUnionMembers bool `marker:",optional"`
4040

41+
// OmitPluginUnionMembers indicates that the Json schema generated from this type should omit Plugin component union members.
42+
OmitPluginUnionMembers bool `marker:",optional"`
43+
4144
// Title indicates the content ot the Json Schema `title` attribute
4245
Title string `marker:",optional"`
4346
}
@@ -213,6 +216,9 @@ This is not the case in the "%s' API group:
213216
if schemaGenerateMarker.OmitCustomUnionMembers {
214217
fieldsToSkip = append(fieldsToSkip, "Custom")
215218
}
219+
if schemaGenerateMarker.OmitPluginUnionMembers {
220+
fieldsToSkip = append(fieldsToSkip, "Plugin")
221+
}
216222

217223
genutils.AddUnionOneOfConstraints(&currentJSONSchema, toDo.unionDiscriminators, true, fieldsToSkip...)
218224

generator/schemas/zz_generated.markerhelp.go

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/workspaces/v1alpha2/devfile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
// Devfile describes the structure of a cloud-native devworkspace and development environment.
88
// +k8s:deepcopy-gen=false
9-
// +devfile:jsonschema:generate:omitCustomUnionMembers=true
9+
// +devfile:jsonschema:generate:omitCustomUnionMembers=true,omitPluginUnionMembers=true
1010
type Devfile struct {
1111
devfile.DevfileHeader `json:",inline"`
1212

samples/devfiles/job-apply-example.devfile.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ components:
1919
command: ["some", "command", "with", "parameters"]
2020
restartPolicy: Never
2121
backoffLimit: 4
22-
- name: go-support
23-
plugin:
24-
id: ms-vscode/go/latest
25-
- name: editor
26-
plugin:
27-
id: eclipse/che-theia/latest
2822
commands:
2923
- id: cleanup-job
3024
apply:

samples/devfiles/nodejs-stack.devfile.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@ projects:
77
remotes:
88
origin: "https://github.com/che-samples/web-nodejs-sample.git"
99
components:
10-
- name: editor
11-
plugin:
12-
id: eclipse/che-theia/7.1.0
13-
- name: terminal
14-
plugin:
15-
id: eclipse/che-machine-exec-plugin/7.1.0
16-
- name: typescript-plugin
17-
plugin:
18-
id: che-incubator/typescript/1.30.2
19-
components:
20-
- name: "somename"
21-
container:
22-
memoryLimit: 512Mi
2310
- name: nodejs
2411
container:
2512
image: quay.io/eclipse/che-nodejs10-ubi:nightly

samples/devfiles/sample-devfile.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,6 @@ projects:
1111
revision: "main"
1212
remote: origin
1313
components:
14-
- name: editor
15-
attributes:
16-
kjkh: "128M"
17-
kjhkjh:
18-
"": ""
19-
plugin:
20-
id: eclipse/che-theia/latest
21-
- name: "ownplugin"
22-
plugin:
23-
id: acme/newPlugin/latest
24-
registryUrl: "https://acme.com/registry/"
25-
- name: "myplugin"
26-
plugin:
27-
uri: "https://github.com/johndoe/che-plugins/blob/master/cool-plugin/0.0.1/meta.yaml"
2814
- name: "mycontainer"
2915
container:
3016
image: "busybox"

samples/devfiles/simple-devfile.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,6 @@ events:
3434
postStart:
3535
- "build-schema-and-open-devfile"
3636
components:
37-
- name: yaml-support
38-
plugin:
39-
id: redhat/vscode-yaml/latest
40-
- name: go-support
41-
plugin:
42-
id: ms-vscode/go/latest
43-
- name: editor
44-
plugin:
45-
id: eclipse/che-theia/latest
46-
registryUrl: "external-registry-url"
4737
- name: "build-tools"
4838
container:
4939
image: some container image with required build tools

samples/devfiles/spring-boot-http-booster-devfile.yaml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,7 @@ projects:
1111
checkoutFrom:
1212
revision: master
1313
components:
14-
- name: java-support
15-
plugin:
16-
id: redhat/java8/latest
17-
components:
18-
- name: vscode-java
19-
container:
20-
memoryLimit: 2Gi
21-
- name: m2
22-
volume:
23-
size: 2G
24-
- name: dependency-analytics
25-
plugin:
26-
id: redhat/dependency-analytics/latest
27-
- name: maven-tooling
14+
- name: maven
2815
container:
2916
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
3017
mountSources: true
@@ -45,6 +32,9 @@ components:
4532
volumeMounts:
4633
- name: m2
4734
path: /home/jboss/.m2
35+
- name: m2
36+
volume:
37+
size: 2G
4838
commands:
4939
- id: build
5040
exec:

0 commit comments

Comments
 (0)