Hello, GeoServer Community,
I’d like to share a new proposal aimed at improving how attribute-level restrictions are managed and exposed in GeoServer.
NOTE: Since I am not allowed to add pages to the Github Wiki, I am posting the full proposal in this post, while adding as an attachment the GSIP in the standard Markdown template.
GSIP-234.md (4.0 KB)
Overview
This proposal introduces support for defining, advertising, and enforcing restrictions on feature type attributes in GeoServer. The goal is to improve data integrity and support clients by:
- Allowing administrators to configure restrictions on feature attributes (e.g., enumerations, min/max ranges).
- Advertising these restrictions to clients via
DescribeFeatureTypeusing standard XML Schema restrictions. - Enforcing the restrictions during write operations (e.g., WFS-T, REST API).
Motivation
GeoServer currently lacks:
- A standardized way to expose attribute-level value restrictions to clients.
- Server-side enforcement of such restrictions on data writes.
- An API for programmatic constraint configuration.
Adding these capabilities will:
- Improve data quality by preventing invalid inputs.
- Enable client applications (e.g., MapStore, GeoNode) to provide appropriate user interfaces (e.g., dropdowns, numeric bounds).
- Ensure consistent behavior across services and interfaces.
Proposed Changes
1. Attribute Constraint Model
Extend the AttributeTypeInfo model to support:
- Enumerations of valid values for string and int attributes.
- Minimum and maximum inclusive bounds for numeric types.
restrictions will be defined per attribute and stored persistently in the featuretype.xml.
2. Restriction Advertising in DescribeFeatureType
Modify the WFS DescribeFeatureType response to include attribute restrictions using standard XSD restriction elements:
xsd:simpleTypewithxsd:restrictionover the base typexsd:enumerationfor fixed valuesxsd:minInclusive/xsd:maxInclusivefor numeric ranges
Examples:
<xsd:element name="status" minOccurs="1" maxOccurs="1" nillable="false">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="ACTIVE"/>
<xsd:enumeration value="INACTIVE"/>
<xsd:enumeration value="UNKNOWN"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="value" minOccurs="1" maxOccurs="1" nillable="false">
<xsd:simpleType>
<xsd:restriction base="xsd:float">
<xsd:minInclusive value="0.0"/>
<xsd:maxInclusive value="100.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
3. Constraint Enforcement on Write
Extend GeoServer’s data validation pipeline to enforce the defined restrictions when receiving data write requests via:
- WFS-T (Insert/Update)
- REST API (PUT/POST)
Restriction compliance checks will occur in GeoserverFeatureStore to centrally ensure consistent enforcement regardless of service or store.
5. Admin UI Support
Enhance the GeoServer admin UI to allow configuring attribute-level restrictions (enumeration, min/max) through the FeatureType editor.
The Feature Type Details table will be made not-editable.
Then, a click on the Edit icon will open a pop-up, to edit the feature type details.
The selection of a specific constraint depends on the type of the attribute.
Example for a “Range” restriction:
Example for an “Options” restriction:
Compatibility
This solution will be aimed to maintain the following:
- Fully backward-compatible: restrictions are optional.
DescribeFeatureTypeoutput remains valid XSD.
This said, I am eager to hear your thoughts and feedback on this proposal.
Please feel free to share any concerns, suggestions, or alternative approaches that you believe should be considered.
Best regards,
Alessandro Ricchiuti




