Constraints

Schema constraints can be documented in the configuration of the feature types in the feature provider. These are used, for example, when generating JSON schema documents.

NameDefaultDescriptionTypeSince
codelist
Identifies a codelist that applies to the property. Meaningful only for string or integer properties.
string
v2.0
enum
List of permitted values for the property. Meaningful only for string or integer properties.
array
v2.0
regex
A regular expression that must be fulfilled by all values. Meaningful only for string properties.
string
v2.0
required
A property can be qualified as a mandatory property that must be set in all instances.
boolean
v2.0
min
Minimum value for all instances. Meaningful only for numerical properties.
number
v2.0
max
Maximum value for all instances. Meaningful only for numerical properties.
number
v2.0
minOccurrence
Minimum number of values for all instances. Meaningful only for array properties.
number
v2.0
maxOccurrence
Maximum number of values for all instances. Meaningful only for array properties.
number
v2.0
composite
Flag to indicate that all geometry components are connected. Only relevant for properties with MultiLineString and MultiPolygon geometries.
boolean
v2.0
closed
Flag to indicate that all geometry values are closed. Only relevant for geometry properties.
boolean
v2.0

As an example, here are the properties of the road sections/branch features (Abschnitt/Ast)open in new window in the API Road network and accidents in NRWopen in new window with constraints:


types:
 abschnitteaeste:
   label: Abschnitte und Äste
   sourcePath: /abschnitteaeste
   type: OBJECT
   properties:
     kennung:
       label: Kennung
       description: 16-stellige Kennung des Abschnittes oder Astes
       sourcePath: abs
       type: STRING
       role: ID
       constraints:
         regex: '^[0-9]{7}[A-Z][0-9]{7}[A-Z]$'
     strasse:
       label: Straße
       type: OBJECT
       objectType: Strasse
       properties:
         bez:
           label: Straßenbezeichnung
           sourcePath: strbez
           type: STRING
         klasse:
           label: Straßenklasse
           sourcePath: strkl
           type: STRING
           constraints:
             enum:
             - A
             - B
             - L
             - K
         nummer:
           label: Straßennummer
           sourcePath: strnr
           type: INTEGER
           constraints:
             min: 1
             max: 9999
         zusatz:
           label: Buchstabenzusatz
           description: Buchstabenzusatz zur Straßennummer
           sourcePath: strzus
           type: STRING
           constraints:
             regex: '^[A-Z]$'
     ...
     absast:
       label: Art
       description: Art des Abschnittes oder Astes
       sourcePath: absast
       type: STRING
       constraints:
         enum:
         - Abschnitt
         - Ast
     ...
     laenge_m:
       label: Länge [m]
       description: Länge des Abschnittes oder Astes (m)
       sourcePath: laenge
       type: INTEGER
       constraints:
         min: 0