Skip to content

Commit

Permalink
add {{ .Group }} variable to schema location options (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
hadar-co committed Jul 16, 2022
1 parent 9a6fff1 commit 5e63bc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Here are the variables you can use in -schema-location:
* *StrictSuffix* - "-strict" or "" depending on whether validation is running in strict mode or not
* *ResourceKind* - Kind of the Kubernetes Resource
* *ResourceAPIVersion* - Version of API used for the resource - "v1" in "apiVersion: monitoring.coreos.com/v1"
* *Group* - the group name as stated in this resource's definition - "monitoring.coreos.com" in "apiVersion: monitoring.coreos.com/v1"
* *KindSuffix* - suffix computed from apiVersion - for compatibility with Kubeval schema registries

### Converting an OpenAPI file to a JSON Schema
Expand Down
2 changes: 2 additions & 0 deletions pkg/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ func schemaPath(tpl, resourceKind, resourceAPIVersion, k8sVersion string, strict
StrictSuffix string
ResourceKind string
ResourceAPIVersion string
Group string
KindSuffix string
}{
normalisedVersion,
strictSuffix,
strings.ToLower(resourceKind),
groupParts[len(groupParts)-1],
groupParts[0],
kindSuffix,
}

Expand Down

0 comments on commit 5e63bc5

Please sign in to comment.