Skip to content

Commit ef78060

Browse files
Merge pull request #41 from PDOK/jd/inspire-keywords
Inspire keywords
2 parents 86277fe + d4feece commit ef78060

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

api/v3/wfs_types.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
shared_model "github.com/pdok/smooth-operator/model"
2929
corev1 "k8s.io/api/core/v1"
3030
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
31+
"slices"
3132
)
3233

3334
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -145,6 +146,15 @@ type WFSService struct {
145146
FeatureTypes []FeatureType `json:"featureTypes"`
146147
}
147148

149+
func (s WFSService) KeywordsIncludingInspireKeyword() []string {
150+
keywords := s.Keywords
151+
if s.Inspire != nil && !slices.Contains(keywords, "infoFeatureAccessService") {
152+
keywords = append(keywords, "infoFeatureAccessService")
153+
}
154+
155+
return keywords
156+
}
157+
148158
type Bbox struct {
149159
// EXTENT/wfs_extent in mapfile
150160
//nolint:tagliatelle

api/v3/wms_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,15 @@ type WMSService struct {
118118
Layer Layer `json:"layer"`
119119
}
120120

121+
func (s WMSService) KeywordsIncludingInspireKeyword() []string {
122+
keywords := s.Keywords
123+
if s.Inspire != nil && !slices.Contains(keywords, "infoMapAccessService") {
124+
keywords = append(keywords, "infoMapAccessService")
125+
}
126+
127+
return keywords
128+
}
129+
121130
// +kubebuilder:validation:XValidation:message="Either blobKeys or configMapRefs is required",rule="has(self.blobKeys) || has(self.configMapRefs)"
122131
type StylingAssets struct {
123132
// +kubebuilder:validations:MinItems:=1

internal/controller/capabilitiesgenerator/mapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func MapWFSToCapabilitiesGeneratorInput(wfs *pdoknlv3.WFS, ownerInfo *smoothoper
4949
Abstract: mapperutils.EscapeQuotes(wfs.Spec.Service.Abstract),
5050
AccessConstraints: *wfs.Spec.Service.AccessConstraints,
5151
Keywords: &wsc110.Keywords{
52-
Keyword: wfs.Spec.Service.Keywords,
52+
Keyword: wfs.Spec.Service.KeywordsIncludingInspireKeyword(),
5353
},
5454
},
5555
Capabilities: wfs200.Capabilities{
@@ -232,7 +232,7 @@ func MapWMSToCapabilitiesGeneratorInput(wms *pdoknlv3.WMS, ownerInfo *smoothoper
232232
Name: "WMS",
233233
Title: mapperutils.EscapeQuotes(wms.Spec.Service.Title),
234234
Abstract: &abstract,
235-
KeywordList: &wms130.Keywords{Keyword: wms.Spec.Service.Keywords},
235+
KeywordList: &wms130.Keywords{Keyword: wms.Spec.Service.KeywordsIncludingInspireKeyword()},
236236
OnlineResource: wms130.OnlineResource{Href: &hostBaseURL},
237237
ContactInformation: getContactInformation(ownerInfo),
238238
Fees: smoothoperatorutils.Pointer("NONE"),

internal/controller/capabilitiesgenerator/test_data/wms_input.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
- Hectometerpunten
3636
- HVD
3737
- Mobiliteit
38+
- infoMapAccessService
3839
onlineResource:
3940
xlink: null
4041
type: null

0 commit comments

Comments
 (0)