Skip to content

Commit 80ec57c

Browse files
author
Jelle Dijkstra
committed
Removed omitempty from layer visibility
1 parent 9fd61d8 commit 80ec57c

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

api/v3/wms_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ type ConfigMapRef struct {
138138
// +kubebuilder:validation:XValidation:message="A layer should have keywords when visible", rule="!self.visible || has(self.keywords)"
139139
// +kubebuilder:validation:XValidation:message="A layer should have a title when visible", rule="!self.visible || has(self.title)"
140140
// +kubebuilder:validation:XValidation:message="A layer should have an abstract when visible", rule="!self.visible || has(self.abstract)"
141-
// +kubebuilder:validation:XValidation:message="A layer should have an authority when visible", rule="!self.visible || has(self.authority)"
142-
// +kubebuilder:validation:XValidation:message="A layer should have a datasetMetadataUrl when visible", rule="!self.visible || has(self.datasetMetadataUrl)"
141+
// +kubebuilder:validation:XValidation:message="A layer should have an authority when visible and has a name", rule="!(self.visible && has(self.name)) || has(self.authority)"
142+
// +kubebuilder:validation:XValidation:message="A layer should have a datasetMetadataUrl when visible and has a name", rule="!(self.visible && has(self.name)) || has(self.datasetMetadataUrl)"
143143
type Layer struct {
144144
// Name of the layer, required for layers on the 2nd or 3rd level
145145
// +kubebuilder:validations:MinLength:=1
@@ -163,7 +163,7 @@ type Layer struct {
163163

164164
// Whether or not the layer is visible. At least one of the layers must be visible.
165165
// +kubebuilder:default:=true
166-
Visible bool `json:"visible,omitempty"`
166+
Visible bool `json:"visible"`
167167

168168
// TODO ??
169169
Authority *Authority `json:"authority,omitempty"`

config/crd/bases/pdok.nl_wms.yaml

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,19 +1857,20 @@ spec:
18571857
description: Whether or not the layer is visible. At least one of the layers must be visible.
18581858
type: boolean
18591859
required:
1860+
- visible
18601861
- name
18611862
type: object
18621863
x-kubernetes-validations:
18631864
- message: A layer should have keywords when visible
1864-
rule: '!self.visible || has(self.keywords)'
1865+
rule: self.visible == false || has(self.keywords)
18651866
- message: A layer should have a title when visible
18661867
rule: '!self.visible || has(self.title)'
18671868
- message: A layer should have an abstract when visible
18681869
rule: '!self.visible || has(self.abstract)'
1869-
- message: A layer should have an authority when visible
1870-
rule: '!self.visible || has(self.authority)'
1871-
- message: A layer should have a datasetMetadataUrl when visible
1872-
rule: '!self.visible || has(self.datasetMetadataUrl)'
1870+
- message: A layer should have an authority when visible and has a name
1871+
rule: '!(self.visible && has(self.name)) || has(self.authority)'
1872+
- message: A layer should have a datasetMetadataUrl when visible and has a name
1873+
rule: '!(self.visible && has(self.name)) || has(self.datasetMetadataUrl)'
18731874
type: array
18741875
maxscaledenominator:
18751876
description: The maximum scale at which this layer functions
@@ -1927,21 +1928,22 @@ spec:
19271928
description: Whether or not the layer is visible. At least one of the layers must be visible.
19281929
type: boolean
19291930
required:
1931+
- visible
19301932
- name
19311933
type: object
19321934
x-kubernetes-validations:
19331935
- message: A layer should have sublayers or data, not both
19341936
rule: (has(self.data) || has(self.layers)) && !(has(self.data) && has(self.layers))
19351937
- message: A layer should have keywords when visible
1936-
rule: '!self.visible || has(self.keywords)'
1938+
rule: self.visible == false || has(self.keywords)
19371939
- message: A layer should have a title when visible
19381940
rule: '!self.visible || has(self.title)'
19391941
- message: A layer should have an abstract when visible
19401942
rule: '!self.visible || has(self.abstract)'
1941-
- message: A layer should have an authority when visible
1942-
rule: '!self.visible || has(self.authority)'
1943-
- message: A layer should have a datasetMetadataUrl when visible
1944-
rule: '!self.visible || has(self.datasetMetadataUrl)'
1943+
- message: A layer should have an authority when visible and has a name
1944+
rule: '!(self.visible && has(self.name)) || has(self.authority)'
1945+
- message: A layer should have a datasetMetadataUrl when visible and has a name
1946+
rule: '!(self.visible && has(self.name)) || has(self.datasetMetadataUrl)'
19451947
type: array
19461948
maxscaledenominator:
19471949
description: The maximum scale at which this layer functions
@@ -1998,20 +2000,22 @@ spec:
19982000
default: true
19992001
description: Whether or not the layer is visible. At least one of the layers must be visible.
20002002
type: boolean
2003+
required:
2004+
- visible
20012005
type: object
20022006
x-kubernetes-validations:
20032007
- message: A layer should have sublayers or data, not both
20042008
rule: (has(self.data) || has(self.layers)) && !(has(self.data) && has(self.layers))
20052009
- message: A layer should have keywords when visible
2006-
rule: '!self.visible || has(self.keywords)'
2010+
rule: self.visible == false || has(self.keywords)
20072011
- message: A layer should have a title when visible
20082012
rule: '!self.visible || has(self.title)'
20092013
- message: A layer should have an abstract when visible
20102014
rule: '!self.visible || has(self.abstract)'
2011-
- message: A layer should have an authority when visible
2012-
rule: '!self.visible || has(self.authority)'
2013-
- message: A layer should have a datasetMetadataUrl when visible
2014-
rule: '!self.visible || has(self.datasetMetadataUrl)'
2015+
- message: A layer should have an authority when visible and has a name
2016+
rule: '!(self.visible && has(self.name)) || has(self.authority)'
2017+
- message: A layer should have a datasetMetadataUrl when visible and has a name
2018+
rule: '!(self.visible && has(self.name)) || has(self.datasetMetadataUrl)'
20152019
mapfile:
20162020
description: Custom mapfile
20172021
properties:

0 commit comments

Comments
 (0)