Skip to content

Commit e808ba1

Browse files
davidfestalmaysunfaisal
authored andcommitted
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]>
1 parent 1f33556 commit e808ba1

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
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 gnerated from this type should omit Custom component union members.
3939
OmitCustomUnionMembers bool `marker:",optional"`
4040

41+
// OmitPluginUnionMembers indicates that the Json schema gnerated 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

0 commit comments

Comments
 (0)