Skip to content

Commit f4b692c

Browse files
author
Jelle Dijkstra
committed
Fixed tests
1 parent 3e89788 commit f4b692c

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-22
lines changed

api/v3/wms_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ type ConfigMapRef struct {
137137
Keys []string `json:"keys,omitempty"`
138138
}
139139

140-
// +kubebuilder:validation:XValidation:message="A layer can only have data or layers, not both.", rule="empty(self.data) || empty(self.layers)"
140+
// +kubebuilder:validation:XValidation:message="A layer can only have data or layers, not both.", rule="has(self.data) || has(self.layers)"
141141
type Layer struct {
142142
// Name of the layer, required for layers on the 2nd or 3rd level
143143
// +kubebuilder:validations:MinLength:=1

api/v3/zz_generated.deepcopy.go

Lines changed: 0 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,9 +1695,6 @@ spec:
16951695
- keywords
16961696
- name
16971697
type: object
1698-
x-kubernetes-validations:
1699-
- message: A layer can only have data or layers, not both.
1700-
rule: empty(self.data) || empty(self.layers)
17011698
type: array
17021699
maxscaledenominator:
17031700
description: The maximum scale at which this layer functions
@@ -1757,7 +1754,7 @@ spec:
17571754
type: object
17581755
x-kubernetes-validations:
17591756
- message: A layer can only have data or layers, not both.
1760-
rule: empty(self.data) || empty(self.layers)
1757+
rule: has(self.data) || has(self.layers)
17611758
type: array
17621759
maxscaledenominator:
17631760
description: The maximum scale at which this layer functions
@@ -1816,7 +1813,7 @@ spec:
18161813
type: object
18171814
x-kubernetes-validations:
18181815
- message: A layer can only have data or layers, not both.
1819-
rule: empty(self.data) || empty(self.layers)
1816+
rule: has(self.data) || has(self.layers)
18201817
mapfile:
18211818
description: Custom mapfile
18221819
properties:

config/crd/update_openapi.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os"
88
"path/filepath"
99
kyaml "sigs.k8s.io/yaml"
10+
"strings"
1011
)
1112

1213
// Usage: go run ./update_layersv3_openapi.go <crd_dir_path>
@@ -42,6 +43,13 @@ func updateWMSV3Layers(crdDir string) {
4243
layerSpecLevel3 := layer.DeepCopy()
4344
layerSpecLevel3.Required = append(layerSpecLevel3.Required, "name")
4445
delete(layerSpecLevel3.Properties, "layers")
46+
xvals := v1.ValidationRules{}
47+
for _, xval := range layerSpecLevel3.XValidations {
48+
if !strings.Contains(xval.Rule, "self.layers") {
49+
xvals = append(xvals, xval)
50+
}
51+
}
52+
layerSpecLevel3.XValidations = xvals
4553

4654
// Level 2
4755
layerSpecLevel2 := layer.DeepCopy()

internal/controller/test_manifests/v3_wms.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
- keyword1
5050
- keyword2
5151
ownerInfoRef:
52-
fees: ""
52+
fees: "test"
5353
accessConstraints: "http://creativecommons.org/publicdomain/zero/1.0/deed.nl"
5454
maxSize:
5555
inspire:

0 commit comments

Comments
 (0)