Skip to content

Commit 5e63bc5

Browse files
author
hadar-co
authoredJul 16, 2022
add {{ .Group }} variable to schema location options (#120)
1 parent 9a6fff1 commit 5e63bc5

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed
 

‎Readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Here are the variables you can use in -schema-location:
194194
* *StrictSuffix* - "-strict" or "" depending on whether validation is running in strict mode or not
195195
* *ResourceKind* - Kind of the Kubernetes Resource
196196
* *ResourceAPIVersion* - Version of API used for the resource - "v1" in "apiVersion: monitoring.coreos.com/v1"
197+
* *Group* - the group name as stated in this resource's definition - "monitoring.coreos.com" in "apiVersion: monitoring.coreos.com/v1"
197198
* *KindSuffix* - suffix computed from apiVersion - for compatibility with Kubeval schema registries
198199

199200
### Converting an OpenAPI file to a JSON Schema

‎pkg/registry/registry.go

+2
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ func schemaPath(tpl, resourceKind, resourceAPIVersion, k8sVersion string, strict
6161
StrictSuffix string
6262
ResourceKind string
6363
ResourceAPIVersion string
64+
Group string
6465
KindSuffix string
6566
}{
6667
normalisedVersion,
6768
strictSuffix,
6869
strings.ToLower(resourceKind),
6970
groupParts[len(groupParts)-1],
71+
groupParts[0],
7072
kindSuffix,
7173
}
7274

0 commit comments

Comments
 (0)
Please sign in to comment.