Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove plugins from the Devfile schema #333

Merged
merged 3 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion generator/schemas/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ import (
// GenerateJSONSchema drives whether a Json schema should be generated from this GO Struct type
type GenerateJSONSchema struct {

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

// OmitPluginUnionMembers indicates that the Json schema generated from this type should omit Plugin component union members.
OmitPluginUnionMembers bool `marker:",optional"`

// Title indicates the content ot the Json Schema `title` attribute
Title string `marker:",optional"`
}
Expand Down Expand Up @@ -213,6 +216,9 @@ This is not the case in the "%s' API group:
if schemaGenerateMarker.OmitCustomUnionMembers {
fieldsToSkip = append(fieldsToSkip, "Custom")
}
if schemaGenerateMarker.OmitPluginUnionMembers {
fieldsToSkip = append(fieldsToSkip, "Plugin")
}

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

Expand Down
6 changes: 5 additions & 1 deletion generator/schemas/zz_generated.markerhelp.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/workspaces/v1alpha2/devfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

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

Expand Down
6 changes: 0 additions & 6 deletions samples/devfiles/job-apply-example.devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ components:
command: ["some", "command", "with", "parameters"]
restartPolicy: Never
backoffLimit: 4
- name: go-support
plugin:
id: ms-vscode/go/latest
- name: editor
plugin:
id: eclipse/che-theia/latest
commands:
- id: cleanup-job
apply:
Expand Down
13 changes: 0 additions & 13 deletions samples/devfiles/nodejs-stack.devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,6 @@ projects:
remotes:
origin: "https://github.com/che-samples/web-nodejs-sample.git"
components:
- name: editor
plugin:
id: eclipse/che-theia/7.1.0
- name: terminal
plugin:
id: eclipse/che-machine-exec-plugin/7.1.0
- name: typescript-plugin
plugin:
id: che-incubator/typescript/1.30.2
components:
- name: "somename"
container:
memoryLimit: 512Mi
- name: nodejs
container:
image: quay.io/eclipse/che-nodejs10-ubi:nightly
Expand Down
14 changes: 0 additions & 14 deletions samples/devfiles/sample-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ projects:
revision: "main"
remote: origin
components:
- name: editor
attributes:
kjkh: "128M"
kjhkjh:
"": ""
plugin:
id: eclipse/che-theia/latest
- name: "ownplugin"
plugin:
id: acme/newPlugin/latest
registryUrl: "https://acme.com/registry/"
- name: "myplugin"
plugin:
uri: "https://github.com/johndoe/che-plugins/blob/master/cool-plugin/0.0.1/meta.yaml"
- name: "mycontainer"
container:
image: "busybox"
Expand Down
10 changes: 0 additions & 10 deletions samples/devfiles/simple-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ events:
postStart:
- "build-schema-and-open-devfile"
components:
- name: yaml-support
plugin:
id: redhat/vscode-yaml/latest
- name: go-support
plugin:
id: ms-vscode/go/latest
- name: editor
plugin:
id: eclipse/che-theia/latest
registryUrl: "external-registry-url"
- name: "build-tools"
container:
image: some container image with required build tools
Expand Down
18 changes: 4 additions & 14 deletions samples/devfiles/spring-boot-http-booster-devfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,7 @@ projects:
checkoutFrom:
revision: master
components:
- name: java-support
plugin:
id: redhat/java8/latest
components:
- name: vscode-java
container:
memoryLimit: 2Gi
- name: m2
volume:
size: 2G
- name: dependency-analytics
plugin:
id: redhat/dependency-analytics/latest
- name: maven-tooling
- name: maven
container:
image: registry.redhat.io/codeready-workspaces/stacks-java-rhel8:2.1
mountSources: true
Expand All @@ -45,6 +32,9 @@ components:
volumeMounts:
- name: m2
path: /home/jboss/.m2
- name: m2
volume:
size: 2G
commands:
- id: build
exec:
Expand Down
Loading