Skip to content

Commit 957b5e1

Browse files
sethfitzvcschapp
authored andcommitted
fix: StrippedConstraint JSON schema pattern accepts empty string
The previous pattern ^(\S.*)?\S$ required at least one non-whitespace character, rejecting empty string. The validator itself accepts empty string ("" == "".strip()), so the JSON schema was more restrictive than the Python validation. New pattern ^(\S(.*\S)?)?$ matches empty string (outer group optional), single non-whitespace chars, and strings bookended by non-whitespace. Updated all JSON schema baselines and inline expectations.
1 parent 0ca959b commit 957b5e1

18 files changed

Lines changed: 77 additions & 60 deletions

File tree

packages/overture-schema-addresses-theme/tests/address_baseline_schema.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"value": {
88
"description": "String with no leading/trailing whitespace",
99
"minLength": 1,
10-
"pattern": "^(\\S.*)?\\S$",
10+
"pattern": "^(\\S(.*\\S)?)?$",
1111
"title": "Value",
1212
"type": "string"
1313
}
@@ -45,7 +45,7 @@
4545
},
4646
"license": {
4747
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
48-
"pattern": "^(\\S.*)?\\S$",
48+
"pattern": "^(\\S(.*\\S)?)?$",
4949
"title": "License",
5050
"type": "string"
5151
},
@@ -160,21 +160,21 @@
160160
"number": {
161161
"description": "The house number.\n\nThis field does not necessarily contain an integer or even a number. Values such as\n\"74B\", \"189 1/2\", and \"208.5\", where the non-integer or non-number part is part of\nthe house number, not a unit number, are in common use.",
162162
"minLength": 1,
163-
"pattern": "^(\\S.*)?\\S$",
163+
"pattern": "^(\\S(.*\\S)?)?$",
164164
"title": "Number",
165165
"type": "string"
166166
},
167167
"postal_city": {
168168
"description": "The postal authority designated city name, if applicable.\n\nIn some countries or regions, a mailing address may need to specify a different city\nname than the city that actually contains the address coordinates. This optional\nfield can be used to specify the alternate city name to use.\n\nFor example:\n\n- The postal city for the US address *716 East County Road, Winchester, Indiana*\n is Ridgeville.\n- The postal city for the Slovenian address *Tomaj 71, 6221 Tomaj, Slovenia* is\n Dutovlje.",
169169
"minLength": 1,
170-
"pattern": "^(\\S.*)?\\S$",
170+
"pattern": "^(\\S(.*\\S)?)?$",
171171
"title": "Postal City",
172172
"type": "string"
173173
},
174174
"postcode": {
175175
"description": "The postal code.",
176176
"minLength": 1,
177-
"pattern": "^(\\S.*)?\\S$",
177+
"pattern": "^(\\S(.*\\S)?)?$",
178178
"title": "Postcode",
179179
"type": "string"
180180
},
@@ -191,7 +191,7 @@
191191
"street": {
192192
"description": "The street name.\n\nThe street name can include a type (*e.g.*, \"Street\" or \"St\", \"Boulevard\" or \"Blvd\",\n*etc.*) and a directional (*e.g.*, \"NW\" or \"Northwest\", \"S\" or \"Sud\"). Both type and\ndirectional, if present, may be either a prefix or a suffix to the primary name.\nThey may either be fully spelled-out or abbreviated.",
193193
"minLength": 1,
194-
"pattern": "^(\\S.*)?\\S$",
194+
"pattern": "^(\\S(.*\\S)?)?$",
195195
"title": "Street",
196196
"type": "string"
197197
},
@@ -208,7 +208,7 @@
208208
"unit": {
209209
"description": "The secondary address unit designator.\n\nIn the case where the primary street address is divided into secondary units, which\nmay be apartments, floors, or even buildings if the primary street address is a\ncampus, this field names the specific secondary unit being addressed.",
210210
"minLength": 1,
211-
"pattern": "^(\\S.*)?\\S$",
211+
"pattern": "^(\\S(.*\\S)?)?$",
212212
"title": "Unit",
213213
"type": "string"
214214
},

packages/overture-schema-base-theme/tests/bathymetry_baseline_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
"license": {
6868
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
69-
"pattern": "^(\\S.*)?\\S$",
69+
"pattern": "^(\\S(.*\\S)?)?$",
7070
"title": "License",
7171
"type": "string"
7272
},

packages/overture-schema-base-theme/tests/infrastructure_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
"value": {
230230
"description": "The actual name value.",
231231
"minLength": 1,
232-
"pattern": "^(\\S.*)?\\S$",
232+
"pattern": "^(\\S(.*\\S)?)?$",
233233
"title": "Value",
234234
"type": "string"
235235
},
@@ -265,7 +265,7 @@
265265
"patternProperties": {
266266
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
267267
"description": "String with no leading/trailing whitespace",
268-
"pattern": "^(\\S.*)?\\S$",
268+
"pattern": "^(\\S(.*\\S)?)?$",
269269
"type": "string"
270270
}
271271
},
@@ -278,7 +278,7 @@
278278
"primary": {
279279
"description": "The most commonly used name.",
280280
"minLength": 1,
281-
"pattern": "^(\\S.*)?\\S$",
281+
"pattern": "^(\\S(.*\\S)?)?$",
282282
"title": "Primary",
283283
"type": "string"
284284
},
@@ -375,7 +375,7 @@
375375
},
376376
"license": {
377377
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
378-
"pattern": "^(\\S.*)?\\S$",
378+
"pattern": "^(\\S(.*\\S)?)?$",
379379
"title": "License",
380380
"type": "string"
381381
},

packages/overture-schema-base-theme/tests/land_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"value": {
103103
"description": "The actual name value.",
104104
"minLength": 1,
105-
"pattern": "^(\\S.*)?\\S$",
105+
"pattern": "^(\\S(.*\\S)?)?$",
106106
"title": "Value",
107107
"type": "string"
108108
},
@@ -138,7 +138,7 @@
138138
"patternProperties": {
139139
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
140140
"description": "String with no leading/trailing whitespace",
141-
"pattern": "^(\\S.*)?\\S$",
141+
"pattern": "^(\\S(.*\\S)?)?$",
142142
"type": "string"
143143
}
144144
},
@@ -151,7 +151,7 @@
151151
"primary": {
152152
"description": "The most commonly used name.",
153153
"minLength": 1,
154-
"pattern": "^(\\S.*)?\\S$",
154+
"pattern": "^(\\S(.*\\S)?)?$",
155155
"title": "Primary",
156156
"type": "string"
157157
},
@@ -248,7 +248,7 @@
248248
},
249249
"license": {
250250
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
251-
"pattern": "^(\\S.*)?\\S$",
251+
"pattern": "^(\\S(.*\\S)?)?$",
252252
"title": "License",
253253
"type": "string"
254254
},

packages/overture-schema-base-theme/tests/land_cover_baseline_schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
},
8484
"license": {
8585
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
86-
"pattern": "^(\\S.*)?\\S$",
86+
"pattern": "^(\\S(.*\\S)?)?$",
8787
"title": "License",
8888
"type": "string"
8989
},

packages/overture-schema-base-theme/tests/land_use_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180
"value": {
181181
"description": "The actual name value.",
182182
"minLength": 1,
183-
"pattern": "^(\\S.*)?\\S$",
183+
"pattern": "^(\\S(.*\\S)?)?$",
184184
"title": "Value",
185185
"type": "string"
186186
},
@@ -216,7 +216,7 @@
216216
"patternProperties": {
217217
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
218218
"description": "String with no leading/trailing whitespace",
219-
"pattern": "^(\\S.*)?\\S$",
219+
"pattern": "^(\\S(.*\\S)?)?$",
220220
"type": "string"
221221
}
222222
},
@@ -229,7 +229,7 @@
229229
"primary": {
230230
"description": "The most commonly used name.",
231231
"minLength": 1,
232-
"pattern": "^(\\S.*)?\\S$",
232+
"pattern": "^(\\S(.*\\S)?)?$",
233233
"title": "Primary",
234234
"type": "string"
235235
},
@@ -326,7 +326,7 @@
326326
},
327327
"license": {
328328
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
329-
"pattern": "^(\\S.*)?\\S$",
329+
"pattern": "^(\\S(.*\\S)?)?$",
330330
"title": "License",
331331
"type": "string"
332332
},

packages/overture-schema-base-theme/tests/water_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"value": {
3434
"description": "The actual name value.",
3535
"minLength": 1,
36-
"pattern": "^(\\S.*)?\\S$",
36+
"pattern": "^(\\S(.*\\S)?)?$",
3737
"title": "Value",
3838
"type": "string"
3939
},
@@ -69,7 +69,7 @@
6969
"patternProperties": {
7070
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
7171
"description": "String with no leading/trailing whitespace",
72-
"pattern": "^(\\S.*)?\\S$",
72+
"pattern": "^(\\S(.*\\S)?)?$",
7373
"type": "string"
7474
}
7575
},
@@ -82,7 +82,7 @@
8282
"primary": {
8383
"description": "The most commonly used name.",
8484
"minLength": 1,
85-
"pattern": "^(\\S.*)?\\S$",
85+
"pattern": "^(\\S(.*\\S)?)?$",
8686
"title": "Primary",
8787
"type": "string"
8888
},
@@ -179,7 +179,7 @@
179179
},
180180
"license": {
181181
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
182-
"pattern": "^(\\S.*)?\\S$",
182+
"pattern": "^(\\S(.*\\S)?)?$",
183183
"title": "License",
184184
"type": "string"
185185
},

packages/overture-schema-buildings-theme/tests/building_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"value": {
166166
"description": "The actual name value.",
167167
"minLength": 1,
168-
"pattern": "^(\\S.*)?\\S$",
168+
"pattern": "^(\\S(.*\\S)?)?$",
169169
"title": "Value",
170170
"type": "string"
171171
},
@@ -201,7 +201,7 @@
201201
"patternProperties": {
202202
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
203203
"description": "String with no leading/trailing whitespace",
204-
"pattern": "^(\\S.*)?\\S$",
204+
"pattern": "^(\\S(.*\\S)?)?$",
205205
"type": "string"
206206
}
207207
},
@@ -214,7 +214,7 @@
214214
"primary": {
215215
"description": "The most commonly used name.",
216216
"minLength": 1,
217-
"pattern": "^(\\S.*)?\\S$",
217+
"pattern": "^(\\S(.*\\S)?)?$",
218218
"title": "Primary",
219219
"type": "string"
220220
},
@@ -362,7 +362,7 @@
362362
},
363363
"license": {
364364
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
365-
"pattern": "^(\\S.*)?\\S$",
365+
"pattern": "^(\\S(.*\\S)?)?$",
366366
"title": "License",
367367
"type": "string"
368368
},

packages/overture-schema-buildings-theme/tests/building_part_baseline_schema.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"value": {
5252
"description": "The actual name value.",
5353
"minLength": 1,
54-
"pattern": "^(\\S.*)?\\S$",
54+
"pattern": "^(\\S(.*\\S)?)?$",
5555
"title": "Value",
5656
"type": "string"
5757
},
@@ -87,7 +87,7 @@
8787
"patternProperties": {
8888
"^(?:(?:[A-Za-z]{2,3}(?:-[A-Za-z]{3}){0,3}?)|(?:[A-Za-z]{4,8}))(?:-[A-Za-z]{4})?(?:-[A-Za-z]{2}|[0-9]{3})?(?:-(?:[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(?:-[A-WY-Za-wy-z0-9](?:-[A-Za-z0-9]{2,8})+)*$": {
8989
"description": "String with no leading/trailing whitespace",
90-
"pattern": "^(\\S.*)?\\S$",
90+
"pattern": "^(\\S(.*\\S)?)?$",
9191
"type": "string"
9292
}
9393
},
@@ -100,7 +100,7 @@
100100
"primary": {
101101
"description": "The most commonly used name.",
102102
"minLength": 1,
103-
"pattern": "^(\\S.*)?\\S$",
103+
"pattern": "^(\\S(.*\\S)?)?$",
104104
"title": "Primary",
105105
"type": "string"
106106
},
@@ -248,7 +248,7 @@
248248
},
249249
"license": {
250250
"description": "Source data license name.\n\nThis should be a valid SPDX license identifier when available.\n\nIf omitted, contact the data provider for more license information.",
251-
"pattern": "^(\\S.*)?\\S$",
251+
"pattern": "^(\\S(.*\\S)?)?$",
252252
"title": "License",
253253
"type": "string"
254254
},

packages/overture-schema-core/tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_feature_json_schema() -> None:
5858
"property": {"type": "string"},
5959
"dataset": {"type": "string"},
6060
"license": {
61-
"pattern": "^(\\S.*)?\\S$",
61+
"pattern": "^(\\S(.*\\S)?)?$",
6262
"type": "string",
6363
},
6464
"record_id": {"type": "string"},

0 commit comments

Comments
 (0)