Skip to content
Merged

1.x #49

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e185869
Added camel-casing to field yaml tags.
Daimanta Feb 26, 2025
cc1911a
Merge pull request #36 from Daimanta/PDOK-17717-renamed-capabilities
Daimanta Mar 19, 2025
018c19a
Pulled out shared exceptions code
Daimanta Mar 21, 2025
595340e
Removed yaml tags of embedded struct
Daimanta Mar 24, 2025
2ba62fd
Camelcased more yaml annotations
Daimanta Mar 24, 2025
9f6564a
Added missing camelcase
Daimanta Mar 24, 2025
12b8bae
Added missing camelcase
Daimanta Mar 24, 2025
2c6a4fe
Small yaml fixes
Daimanta Mar 25, 2025
16b4e45
Small yaml fixes
Daimanta Mar 25, 2025
d06ab29
Small yaml fixes
Daimanta Mar 25, 2025
2a2d87e
Small yaml fixes
Daimanta Mar 25, 2025
e86b9b1
Removed expanded struct
Daimanta Mar 25, 2025
3ca35da
Merge pull request #37 from PDOK/PDOK-17717-renamed-capabilities
Daimanta Mar 26, 2025
ac82336
Refactor anonymous structs
damienmulder Mar 27, 2025
c3dbbc1
Refactor anonymous structs
damienmulder Mar 27, 2025
429e105
Refactor anonymous structs
damienmulder Mar 27, 2025
1276aaa
Merge pull request #38 from PDOK/1.x-refactor-anonymous-structs
damienmulder Mar 27, 2025
985788a
Refactor anonymous structs
damienmulder Mar 31, 2025
a70d7e8
YAML tags for marshalling WFS capabilities
damienmulder Mar 31, 2025
1d17d84
YAML tags for marshalling WFS capabilities
damienmulder Mar 31, 2025
860f6d7
Merge pull request #39 from PDOK/1.x-refactor-anonymous-structs
damienmulder Apr 1, 2025
4fc3fc2
Add test workflow
damienmulder Apr 2, 2025
6702184
Add test workflow
damienmulder Apr 2, 2025
51c5edb
Merge pull request #40 from PDOK/github-workflows
damienmulder Apr 2, 2025
7704ee7
Made several WMS fields optional that are not required in the capabil…
Daimanta Apr 4, 2025
cefe943
Merge pull request #41 from Daimanta/wms-1-3-0-marked-optional-fields
Daimanta Apr 7, 2025
1689bcf
Marshaller for CRS
Apr 30, 2025
f51e5e9
Merge pull request #42 from PDOK/jd/crs-marshaller
jelledijkstra97 Apr 30, 2025
d8c6293
Marshaller on CRS instead of *CRS
Apr 30, 2025
43d7540
Merge pull request #43 from PDOK/jd/crs-marshaller
jelledijkstra97 Apr 30, 2025
4d7f967
Added omitempty to some fields
May 20, 2025
3f2a851
Merge pull request #44 from PDOK/jd/omitempty
jelledijkstra97 May 20, 2025
fc6141a
Optional contraints inline
May 20, 2025
0732ed9
Removed xml tag for optional contraints
May 20, 2025
3a6fd51
Merge pull request #45 from PDOK/jd/optional-constraints
jelledijkstra97 May 20, 2025
8c04024
Added missing marshallers
May 28, 2025
cd22e36
Merge pull request #46 from PDOK/jd/marshallers
Shalucik May 30, 2025
89f357a
Changed YAML marshaller for CRS
Jun 16, 2025
49311bb
Fixed tests
Jun 16, 2025
fd4a10e
Merge pull request #47 from PDOK/jd/crs-yaml
jelledijkstra97 Jun 16, 2025
822c44e
Reverted changes
Jun 17, 2025
9d6fe32
Reverted changes
Jun 17, 2025
6402df1
Merge pull request #48 from PDOK/jd/crs-yaml
jelledijkstra97 Jun 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Tests

on:
push:
pull_request:

jobs:
test:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Running Tests
run: |
go mod tidy
go test ./... -covermode=atomic
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module github.com/pdok/ogc-specifications

go 1.16
go 1.24

require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
require gopkg.in/yaml.v3 v3.0.1
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 7 additions & 0 deletions pkg/common/exception.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package common

type ExceptionDetails struct {
ExceptionText string `xml:",chardata" yaml:"exception"`
ExceptionCode string `xml:"code,attr" yaml:"exceptionCode"`
LocatorCode string `xml:"locator,attr,omitempty" yaml:"locatorCode"`
}
138 changes: 86 additions & 52 deletions pkg/wcs201/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,87 +12,121 @@ func (c *Capabilities) ParseYAML(doc []byte) error {

// Capabilities struct
type Capabilities struct {
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsmetadata"`
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"servicemetadata"`
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsMetadata"`
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"serviceMetadata"`
Contents Contents `xml:"wcs:Contents" yaml:"contents"`
}

// OperationsMetadata struct for the WCS 2.0.1
type OperationsMetadata struct {
Operation []Operation `xml:"ows:Operation" yaml:"operation"`
ExtendedCapabilities *ExtendedCapabilities `xml:"ows:ExtendedCapabilities" yaml:"extendedcapabilities"`
ExtendedCapabilities *ExtendedCapabilities `xml:"ows:ExtendedCapabilities" yaml:"extendedCapabilities"`
}

// Operation in struct for repeatability
type Operation struct {
Name string `xml:"name,attr" yaml:"name"`
DCP struct {
HTTP struct {
Get struct {
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
} `xml:"ows:Get" yaml:"get"`
Post *Post `xml:"ows:Post" yaml:"post"`
} `xml:"ows:HTTP" yaml:"http"`
} `xml:"ows:DCP" yaml:"dcp"`
DCP DCP `xml:"ows:DCP" yaml:"dcp"`
}

// DCP struct for the WCS 2.0.1
type DCP struct {
HTTP HTTP `xml:"ows:HTTP" yaml:"http"`
}

// HTTP struct for the WCS 2.0.1
type HTTP struct {
Get Get `xml:"ows:Get" yaml:"get"`
Post *Post `xml:"ows:Post" yaml:"post"`
}

// Get struct for the WCS 2.0.1
type Get struct {
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
}

// Post in separated struct so to use it as a Pointer
type Post struct {
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
Constraint struct {
Name string `xml:"name,attr" yaml:"name"`
AllowedValues struct {
Value []string `xml:"ows:Value" yaml:"value"`
} `xml:"ows:AllowedValues" yaml:"allowedvalues"`
} `xml:"ows:Constraint" yaml:"constraint"`
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
Constraint Constraint `xml:"ows:Constraint" yaml:"constraint"`
}

// Constraint struct for the WCS 2.0.1
type Constraint struct {
Name string `xml:"name,attr" yaml:"name"`
AllowedValues AllowedValues `xml:"ows:AllowedValues" yaml:"allowedValues"`
}

// AllowedValues struct for the WCS 2.0.1
type AllowedValues struct {
Value []string `xml:"ows:Value" yaml:"value"`
}

// ExtendedCapabilities struct for the WCS 2.0.1
type ExtendedCapabilities struct {
ExtendedCapabilities struct {
MetadataURL struct {
URL string `xml:"inspire_common:URL"`
MediaType string `xml:"inspire_common:MediaType"`
} `xml:"inspire_common:MetadataUrl"`
SupportedLanguages struct {
DefaultLanguage struct {
Language string `xml:"inspire_common:Language"`
} `xml:"inspire_common:DefaultLanguage"`
SupportedLanguage *[]struct {
Language string `xml:"inspire_common:Language" yaml:"language"`
} `xml:"inspire_common:SupportedLanguage" yaml:"supportedlanguage"`
} `xml:"inspire_common:SupportedLanguages"`
ResponseLanguage struct {
Language string `xml:"inspire_common:Language"`
} `xml:"inspire_common:ResponseLanguage"`
SpatialDataSetIdentifier struct {
Code string `xml:"Code"`
} `xml:"inspire_dls:SpatialDataSetIdentifier"`
} `xml:"inspire_dls:ExtendedCapabilities"`
ExtendedCapabilities NestedExtendedCapabilities `xml:"inspire_dls:ExtendedCapabilities" yaml:"extendedCapabilities"`
}

// NestedExtendedCapabilities struct for the WCS 2.0.1
type NestedExtendedCapabilities struct {
MetadataURL MetadataURL `xml:"inspire_common:MetadataUrl"`
ResponseLanguage Language `xml:"inspire_common:ResponseLanguage" yaml:"responseLanguage"`
SpatialDataSetIdentifier SpatialDataSetIdentifier `xml:"inspire_dls:SpatialDataSetIdentifier" yaml:"spatialDataSetIdentifier"`
}

// MetadataURL struct { struct for the WCS 2.0.1
type MetadataURL struct {
URL string `xml:"inspire_common:URL" yaml:"url"`
MediaType string `xml:"inspire_common:MediaType" yaml:"mediaType"`
}

// SupportedLanguages struct for the struct for the WCS 2.0.1
type SupportedLanguages struct {
DefaultLanguage Language `xml:"inspire_common:DefaultLanguage" yaml:"defaultLanguage"`
SupportedLanguage *[]Language `xml:"inspire_common:SupportedLanguage" yaml:"supportedLanguage"`
}

// Language struct for the WCS 2.0.1
type Language struct {
Language string `xml:"inspire_common:Language" yaml:"language"`
}

// SpatialDataSetIdentifier struct for the WCS 2.0.1
type SpatialDataSetIdentifier struct {
Code string `xml:"Code" yaml:"code"`
}

// ServiceMetadata struct for the WCS 2.0.1
type ServiceMetadata struct {
FormatSupported []string `xml:"wcs:formatSupported"`
Extension struct {
InterpolationMetadata struct {
InterpolationSupported []string `xml:"int:InterpolationSupported"`
} `xml:"int:InterpolationMetadata"`
CrsMetadata struct {
CrsSupported []string `xml:"crs:crsSupported"`
} `xml:"crs:CrsMetadata"`
} `xml:"wcs:Extension"`
FormatSupported []string `xml:"wcs:formatSupported" yaml:"formatSupported"`
Extension Extension `xml:"wcs:Extension" yaml:"extension"`
}

// Extension struct for the WCS 2.0.1
type Extension struct {
InterpolationMetadata InterpolationMetadata `xml:"int:InterpolationMetadata" yaml:"interpolationMetadata"`
CrsMetadata CrsMetadata `xml:"crs:CrsMetadata" yaml:"crsMetadata"`
}

// InterpolationMetadata struct for the WCS 2.0.1
type InterpolationMetadata struct {
InterpolationSupported []string `xml:"int:InterpolationSupported" yaml:"interpolationSupported"`
}

// CrsMetadata struct for the WCS 2.0.1
type CrsMetadata struct {
CrsSupported []string `xml:"crs:crsSupported" yaml:"crsSupported"`
}

// Contents in struct for repeatability
type Contents struct {
CoverageSummary []CoverageSummary `xml:"wcs:CoverageSummary"`
CoverageSummary []CoverageSummary `xml:"wcs:CoverageSummary" yaml:"coverageSummary"`
}

// CoverageSummary in struct for repeatability
type CoverageSummary struct {
CoverageID string `xml:"wcs:CoverageId"`
CoverageSubtype string `xml:"wcs:CoverageSubtype"`
CoverageID string `xml:"wcs:CoverageId" yaml:"coverageId"`
CoverageSubtype string `xml:"wcs:CoverageSubtype" yaml:"coverageSubtype"`
}
4 changes: 2 additions & 2 deletions pkg/wcs201/getcapabilities_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func (gc GetCapabilitiesRequest) ToXML() []byte {

// GetCapabilitiesRequest struct with the needed parameters/attributes needed for making a GetCapabilities request
type GetCapabilitiesRequest struct {
XMLName xml.Name `xml:"GetCapabilities" yaml:"getcapabilities"`
XMLName xml.Name `xml:"GetCapabilities" yaml:"getCapabilities"`
Service string `xml:"service,attr" yaml:"service"`
Version string `xml:"version,attr" yaml:"version"`
Attr utils.XMLAttribute `xml:",attr"`
Attr utils.XMLAttribute `xml:",attr" yaml:"attr"`
}
121 changes: 72 additions & 49 deletions pkg/wcs201/getcapabilities_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ func (gc GetCapabilitiesResponse) ToXML() []byte {

// GetCapabilitiesResponse base struct
type GetCapabilitiesResponse struct {
XMLName xml.Name `xml:"wcs:Capabilities"`
Namespaces `yaml:"namespaces"`
ServiceIdentification ServiceIdentification `xml:"ows:ServiceIdentification" yaml:"serviceidentification"`
ServiceProvider ServiceProvider `xml:"ows:ServiceProvider" yaml:"serviceprovider"`
Capabilities
XMLName xml.Name `xml:"wcs:Capabilities" yaml:"wcsCapabilities"`
Namespaces
ServiceIdentification ServiceIdentification `xml:"ows:ServiceIdentification" yaml:"serviceIdentification"`
ServiceProvider ServiceProvider `xml:"ows:ServiceProvider" yaml:"serviceProvider"`
OperationsMetadata OperationsMetadata `xml:"ows:OperationsMetadata" yaml:"operationsMetadata"`
ServiceMetadata ServiceMetadata `xml:"wcs:ServiceMetadata" yaml:"serviceMetadata"`
Contents Contents `xml:"wcs:Contents" yaml:"contents"`
}

// Namespaces struct containing the namespaces needed for the XML document
Expand All @@ -48,59 +50,80 @@ type Namespaces struct {
XmlnsGML string `xml:"xmlns:gml,attr" yaml:"gml"` //http://www.opengis.net/gml/3.2
XmlnsGMLcov string `xml:"xmlns:gmlcov,attr" yaml:"gmlcov"` //http://www.opengis.net/gmlcov/1.0
XmlnsSWE string `xml:"xmlns:swe,attr" yaml:"swe"` //http://www.opengis.net/swe/2.0
XmlnsInspireCommon string `xml:"xmlns:inspire_common,attr,omitempty" yaml:"inspirecommon"` //http://inspire.ec.europa.eu/schemas/common/1.0
XmlnsInspireDls string `xml:"xmlns:inspire_dls,attr,omitempty" yaml:"inspiredls"` //http://inspire.ec.europa.eu/schemas/inspire_dls/1.0
XmlnsInspireCommon string `xml:"xmlns:inspire_common,attr,omitempty" yaml:"inspireCommon"` //http://inspire.ec.europa.eu/schemas/common/1.0
XmlnsInspireDls string `xml:"xmlns:inspire_dls,attr,omitempty" yaml:"inspireDls"` //http://inspire.ec.europa.eu/schemas/inspire_dls/1.0
XmlnsCrs string `xml:"xmlns:crs,attr" yaml:"crs"` //http://www.opengis.net/wcs/crs/1.0
XmlnsInt string `xml:"xmlns:int,attr" yaml:"int"` //http://www.opengis.net/wcs/interpolation/1.0
Version string `xml:"version,attr" yaml:"version"`
SchemaLocation string `xml:"xsi:schemaLocation,attr" yaml:"schemalocation"`
SchemaLocation string `xml:"xsi:schemaLocation,attr" yaml:"schemaLocation"`
}

// ServiceIdentification struct should only be fill by the "template" configuration wcs201.yaml
type ServiceIdentification struct {
Title string `xml:"ows:Title" yaml:"title"`
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
ServiceType struct {
Text string `xml:",chardata" yaml:"text"`
CodeSpace string `xml:"codeSpace,attr" yaml:"codespace"`
} `xml:"ows:ServiceType" yaml:"servicetype"`
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"servicetypeversion"`
Profile []string `xml:"ows:Profile" yaml:"profile"`
Fees string `xml:"ows:Fees" yaml:"fees"`
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessconstraints"`
Title string `xml:"ows:Title" yaml:"title"`
Abstract string `xml:"ows:Abstract" yaml:"abstract"`
Keywords *wsc200.Keywords `xml:"ows:Keywords" yaml:"keywords"`
ServiceType ServiceType `xml:"ows:ServiceType" yaml:"serviceType"`
ServiceTypeVersion []string `xml:"ows:ServiceTypeVersion" yaml:"serviceTypeVersion"`
Profile []string `xml:"ows:Profile" yaml:"profile"`
Fees string `xml:"ows:Fees" yaml:"fees"`
AccessConstraints string `xml:"ows:AccessConstraints" yaml:"accessConstraints"`
}

// ServiceType struct containing the service type
type ServiceType struct {
Text string `xml:",chardata" yaml:"text"`
CodeSpace string `xml:"codeSpace,attr" yaml:"codeSpace"`
}

// ServiceProvider struct containing the provider/organization information should only be fill by the "template" configuration wcs201.yaml
type ServiceProvider struct {
ProviderName string `xml:"ows:ProviderName" yaml:"providername"`
ProviderSite struct {
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
} `xml:"ows:ProviderSite" yaml:"providersite"`
ServiceContact struct {
IndividualName string `xml:"ows:IndividualName" yaml:"individualname"`
PositionName string `xml:"ows:PositionName" yaml:"positionname"`
ContactInfo struct {
Phone struct {
Voice string `xml:"ows:Voice" yaml:"voice"`
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
} `xml:"ows:Phone" yaml:"phone"`
Address struct {
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliverypoint"`
City string `xml:"ows:City" yaml:"city"`
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativearea"`
PostalCode string `xml:"ows:PostalCode" yaml:"postalcode"`
Country string `xml:"ows:Country" yaml:"country"`
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicmailaddress"`
} `xml:"ows:Address" yaml:"address"`
OnlineResource *struct {
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
} `xml:"ows:OnlineResource,omitempty" yaml:"onlineresource"`
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursofservice"`
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactinstructions"`
} `xml:"ows:ContactInfo" yaml:"contactinfo"`
Role string `xml:"ows:Role,omitempty" yaml:"role"`
} `xml:"ows:ServiceContact" yaml:"servicecontact"`
ProviderName string `xml:"ows:ProviderName" yaml:"providerName"`
ProviderSite `xml:"ows:ProviderSite" yaml:"providerSite"`
ServiceContact ServiceContact `xml:"ows:ServiceContact" yaml:"serviceContact"`
}

// ProviderSite struct containing the website of the provider/organization
type ProviderSite struct {
Type string `xml:"xlink:type,attr" yaml:"type"`
Href string `xml:"xlink:href,attr" yaml:"href"`
}

// ServiceContact struct containing information for the person to contact
type ServiceContact struct {
IndividualName string `xml:"ows:IndividualName" yaml:"individualName"`
PositionName string `xml:"ows:PositionName" yaml:"positionName"`
ContactInfo ContactInfo `xml:"ows:ContactInfo" yaml:"contactInfo"`
Role string `xml:"ows:Role,omitempty" yaml:"role"`
}

// ContactInfo struct containing the contact information for the service
type ContactInfo struct {
Phone Phone `xml:"ows:Phone" yaml:"phone"`
Address Address `xml:"ows:Address" yaml:"address"`
OnlineResource *OnlineResource `xml:"ows:OnlineResource,omitempty" yaml:"onlineResource"`
HoursOfService string `xml:"ows:HoursOfService,omitempty" yaml:"hoursOfService"`
ContactInstructions string `xml:"ows:ContactInstructions,omitempty" yaml:"contactInstructions"`
}

// Phone struct containing the contact telephone or fax number
type Phone struct {
Voice string `xml:"ows:Voice" yaml:"voice"`
Facsimile string `xml:"ows:Facsimile" yaml:"facsimile"`
}

// Address struct containing the address for the contact supplying the service
type Address struct {
DeliveryPoint string `xml:"ows:DeliveryPoint" yaml:"deliveryPoint"`
City string `xml:"ows:City" yaml:"city"`
AdministrativeArea string `xml:"ows:AdministrativeArea" yaml:"administrativeArea"`
PostalCode string `xml:"ows:PostalCode" yaml:"postalCode"`
Country string `xml:"ows:Country" yaml:"country"`
ElectronicMailAddress string `xml:"ows:ElectronicMailAddress" yaml:"electronicMailAddress"`
}

// OnlineResource struct containing the top-level web address of a service or service provider
type OnlineResource *struct {
Type string `xml:"xlink:type,attr,omitempty" yaml:"type"`
Href string `xml:"xlink:href,attr,omitempty" yaml:"href"`
}
Loading