Skip to content

Commit e4db810

Browse files
authored
Merge pull request #27 from PDOK/PDOK-17899-immutable-url
Changed base URL check to shared function
2 parents dbf24c1 + d8a9521 commit e4db810

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

api/v3/wfs_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,7 @@ func (wfs *WFS) GeoPackages() []*Gpkg {
244244

245245
return gpkgs
246246
}
247+
248+
func (wfs *WFS) GetBaseUrl() string {
249+
return wfs.Spec.Service.URL
250+
}

api/v3/wfs_validation.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ func (wfs *WFS) ValidateUpdate(wfsOld *WFS) ([]string, error) {
3535
reasons = append(reasons, fmt.Sprintf("%v", err))
3636
}
3737

38-
// Check service.baseURL did not change
39-
if wfs.Spec.Service.URL != wfsOld.Spec.Service.URL {
40-
reasons = append(reasons, "service.baseURL is immutable")
41-
}
38+
sharedValidation.CheckBaseUrlImmutability(wfsOld, wfs, &reasons)
4239

4340
if (wfs.Spec.Service.Inspire == nil && wfsOld.Spec.Service.Inspire != nil) || (wfs.Spec.Service.Inspire != nil && wfsOld.Spec.Service.Inspire == nil) {
4441
reasons = append(reasons, "services cannot change from inspire to not inspire or the other way around")

api/v3/wms_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,7 @@ func (wms *WMS) GeoPackages() []*Gpkg {
561561

562562
return gpkgs
563563
}
564+
565+
func (wms *WMS) GetBaseUrl() string {
566+
return wms.Spec.Service.URL
567+
}

api/v3/wms_validation.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ func (wms *WMS) ValidateUpdate(wmsOld *WMS) ([]string, error) {
3636
reasons = append(reasons, fmt.Sprintf("%v", err))
3737
}
3838

39-
// Check service.baseURL did not change
40-
if wms.Spec.Service.URL != wmsOld.Spec.Service.URL {
41-
reasons = append(reasons, "service.baseURL is immutable")
42-
}
39+
sharedValidation.CheckBaseUrlImmutability(wmsOld, wms, &reasons)
4340

4441
if (wms.Spec.Service.Inspire == nil && wmsOld.Spec.Service.Inspire != nil) || (wms.Spec.Service.Inspire != nil && wmsOld.Spec.Service.Inspire == nil) {
4542
reasons = append(reasons, "services cannot change from inspire to not inspire or the other way around")

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/pdok/featureinfo-generator v1.4.0-beta1
1414
github.com/pdok/ogc-capabilities-generator v1.0.0-beta7
1515
github.com/pdok/ogc-specifications v1.0.0-beta7
16-
github.com/pdok/smooth-operator v0.0.16
16+
github.com/pdok/smooth-operator v0.0.18-0.20250502130008-44dd7efe5125
1717
github.com/stretchr/testify v1.10.0
1818
github.com/traefik/traefik/v3 v3.3.4
1919
k8s.io/api v0.32.3

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ github.com/pdok/ogc-specifications v1.0.0-beta7 h1:AFSO8iCYbD1MrjOS2q+PGp2PmSqAH
155155
github.com/pdok/ogc-specifications v1.0.0-beta7/go.mod h1:YDngwkwrWOfc5MYnEYseiv97K1Y9bZXlVzwi/8EaIl8=
156156
github.com/pdok/smooth-operator v0.0.16 h1:1vurI2TPDHmTaTu0YeG1B9mIIa5MT6GPWhixiZ/styg=
157157
github.com/pdok/smooth-operator v0.0.16/go.mod h1:ohDqrUnmS7wK8TrNHJnFS/mDgf26Yhb8mtRBX3ixdr4=
158+
github.com/pdok/smooth-operator v0.0.18-0.20250502130008-44dd7efe5125 h1:0ZIPfe6USM5Jm0MC8tngDxPIFvBSTOrNY53S7pA9Lh4=
159+
github.com/pdok/smooth-operator v0.0.18-0.20250502130008-44dd7efe5125/go.mod h1:ohDqrUnmS7wK8TrNHJnFS/mDgf26Yhb8mtRBX3ixdr4=
158160
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
159161
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
160162
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=

0 commit comments

Comments
 (0)