Skip to content

Commit a414208

Browse files
committed
Some minor hardening
1 parent ade6817 commit a414208

2 files changed

Lines changed: 42 additions & 18 deletions

File tree

‎schemas/radformatter/config/latest/config.schema.json‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"properties": {
2626
"schemaVersion": {
2727
"type": "string",
28-
"pattern": "^[0-9]+\\.[0-9]+$",
29-
"description": "Config schema version (MAJOR.MINOR). Governs reader compatibility; independent of the product version."
28+
"pattern": "^2\\.[0-9]+$",
29+
"description": "Config schema version (MAJOR.MINOR). This schema describes major 2.x; a config for a different major should reference that major's schema. Governs reader compatibility; independent of the product version."
3030
},
3131
"$schema": {
3232
"type": "string",
@@ -192,7 +192,8 @@
192192
},
193193
"maxConsecutiveSpaces": {
194194
"type": "integer",
195-
"description": "Maximum consecutive interior spaces (0 = unlimited)."
195+
"minimum": -1,
196+
"description": "Maximum consecutive interior spaces (-1 = no limit)."
196197
}
197198
}
198199
},
@@ -202,10 +203,12 @@
202203
"properties": {
203204
"size": {
204205
"type": "integer",
206+
"minimum": 0,
205207
"description": "Indent width in spaces."
206208
},
207209
"tabWidth": {
208210
"type": "integer",
211+
"minimum": 0,
209212
"description": "Tab display width."
210213
},
211214
"style": {
@@ -228,6 +231,7 @@
228231
},
229232
"continuationSize": {
230233
"type": "integer",
234+
"minimum": 0,
231235
"description": "Extra indent for wrapped continuation lines."
232236
},
233237
"anchorBased": {
@@ -236,6 +240,7 @@
236240
},
237241
"maxColumn": {
238242
"type": "integer",
243+
"minimum": 0,
239244
"description": "Cap computed indent at this column (0 = uncapped)."
240245
},
241246
"caseLabels": {
@@ -383,6 +388,7 @@
383388
},
384389
"maxPadWidth": {
385390
"type": "integer",
391+
"minimum": 0,
386392
"description": "Maximum padding width for alignment."
387393
}
388394
}
@@ -403,31 +409,37 @@
403409
},
404410
"rightMargin": {
405411
"type": "integer",
412+
"minimum": 0,
406413
"description": "Right margin for wrapping (0 = off)."
407414
},
408415
"maxEmptyLines": {
409416
"type": "integer",
410-
"description": "Maximum consecutive empty lines."
417+
"minimum": -1,
418+
"description": "Maximum consecutive empty lines (-1 = no limit)."
411419
},
412420
"emptyLines": {
413421
"type": "object",
414-
"description": "Empty-line counts at structural positions.",
422+
"description": "Empty-line counts at structural positions (-1 = leave source unchanged).",
415423
"properties": {
416424
"beforeVisibility": {
417425
"type": "integer",
418-
"description": "Empty lines before a visibility section."
426+
"minimum": -1,
427+
"description": "Empty lines before a visibility section (-1 = leave as source)."
419428
},
420429
"aroundSections": {
421430
"type": "integer",
422-
"description": "Empty lines around sections."
431+
"minimum": -1,
432+
"description": "Empty lines around sections (-1 = leave as source)."
423433
},
424434
"betweenDeclarations": {
425435
"type": "integer",
426-
"description": "Empty lines between declarations."
436+
"minimum": -1,
437+
"description": "Empty lines between declarations (-1 = leave as source)."
427438
},
428439
"beforeTypeKeyword": {
429440
"type": "integer",
430-
"description": "Empty lines before a type keyword."
441+
"minimum": -1,
442+
"description": "Empty lines before a type keyword (-1 = leave as source)."
431443
}
432444
}
433445
},

‎schemas/radformatter/config/v2.0/config.schema.json‎

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"properties": {
2626
"schemaVersion": {
2727
"type": "string",
28-
"pattern": "^[0-9]+\\.[0-9]+$",
29-
"description": "Config schema version (MAJOR.MINOR). Governs reader compatibility; independent of the product version."
28+
"pattern": "^2\\.[0-9]+$",
29+
"description": "Config schema version (MAJOR.MINOR). This schema describes major 2.x; a config for a different major should reference that major's schema. Governs reader compatibility; independent of the product version."
3030
},
3131
"$schema": {
3232
"type": "string",
@@ -192,7 +192,8 @@
192192
},
193193
"maxConsecutiveSpaces": {
194194
"type": "integer",
195-
"description": "Maximum consecutive interior spaces (0 = unlimited)."
195+
"minimum": -1,
196+
"description": "Maximum consecutive interior spaces (-1 = no limit)."
196197
}
197198
}
198199
},
@@ -202,10 +203,12 @@
202203
"properties": {
203204
"size": {
204205
"type": "integer",
206+
"minimum": 0,
205207
"description": "Indent width in spaces."
206208
},
207209
"tabWidth": {
208210
"type": "integer",
211+
"minimum": 0,
209212
"description": "Tab display width."
210213
},
211214
"style": {
@@ -228,6 +231,7 @@
228231
},
229232
"continuationSize": {
230233
"type": "integer",
234+
"minimum": 0,
231235
"description": "Extra indent for wrapped continuation lines."
232236
},
233237
"anchorBased": {
@@ -236,6 +240,7 @@
236240
},
237241
"maxColumn": {
238242
"type": "integer",
243+
"minimum": 0,
239244
"description": "Cap computed indent at this column (0 = uncapped)."
240245
},
241246
"caseLabels": {
@@ -383,6 +388,7 @@
383388
},
384389
"maxPadWidth": {
385390
"type": "integer",
391+
"minimum": 0,
386392
"description": "Maximum padding width for alignment."
387393
}
388394
}
@@ -403,31 +409,37 @@
403409
},
404410
"rightMargin": {
405411
"type": "integer",
412+
"minimum": 0,
406413
"description": "Right margin for wrapping (0 = off)."
407414
},
408415
"maxEmptyLines": {
409416
"type": "integer",
410-
"description": "Maximum consecutive empty lines."
417+
"minimum": -1,
418+
"description": "Maximum consecutive empty lines (-1 = no limit)."
411419
},
412420
"emptyLines": {
413421
"type": "object",
414-
"description": "Empty-line counts at structural positions.",
422+
"description": "Empty-line counts at structural positions (-1 = leave source unchanged).",
415423
"properties": {
416424
"beforeVisibility": {
417425
"type": "integer",
418-
"description": "Empty lines before a visibility section."
426+
"minimum": -1,
427+
"description": "Empty lines before a visibility section (-1 = leave as source)."
419428
},
420429
"aroundSections": {
421430
"type": "integer",
422-
"description": "Empty lines around sections."
431+
"minimum": -1,
432+
"description": "Empty lines around sections (-1 = leave as source)."
423433
},
424434
"betweenDeclarations": {
425435
"type": "integer",
426-
"description": "Empty lines between declarations."
436+
"minimum": -1,
437+
"description": "Empty lines between declarations (-1 = leave as source)."
427438
},
428439
"beforeTypeKeyword": {
429440
"type": "integer",
430-
"description": "Empty lines before a type keyword."
441+
"minimum": -1,
442+
"description": "Empty lines before a type keyword (-1 = leave as source)."
431443
}
432444
}
433445
},

0 commit comments

Comments
 (0)