schema-markdown 1.2.9 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/parser.js CHANGED
@@ -7,7 +7,8 @@ import {validateTypeModelErrors} from './schemaUtil.js';
7
7
 
8
8
 
9
9
  // Built-in types
10
- const builtinTypes = new Set(['bool', 'date', 'datetime', 'float', 'int', 'object', 'string', 'uuid']);
10
+ const builtinTypes = new Set(['any', 'bool', 'date', 'datetime', 'float', 'int', 'string', 'uuid']);
11
+ const builtinDeprecated = {'object': 'any'};
11
12
 
12
13
 
13
14
  // Schema Markdown regex
@@ -213,7 +214,7 @@ export function parseSchemaMarkdown(text, {types = {}, filename = '', validate =
213
214
  const definitionBaseIds = match.groups.baseIds;
214
215
 
215
216
  // Type already defined?
216
- if (builtinTypes.has(definitionId) || definitionId in types) {
217
+ if (builtinTypes.has(definitionId) || definitionId in builtinDeprecated || definitionId in types) {
217
218
  addError(`Redefinition of type '${definitionId}'`, filename, linenum);
218
219
  }
219
220
 
@@ -391,7 +392,7 @@ export function parseSchemaMarkdown(text, {types = {}, filename = '', validate =
391
392
  const definitionId = match.groups.id;
392
393
 
393
394
  // Type already defined?
394
- if (builtinTypes.has(definitionId) || definitionId in types) {
395
+ if (builtinTypes.has(definitionId) || definitionId in builtinDeprecated || definitionId in types) {
395
396
  addError(`Redefinition of type '${definitionId}'`, filename, linenum);
396
397
  }
397
398
 
@@ -514,6 +515,9 @@ function parseTypedef(matchTypedef) {
514
515
 
515
516
  // Helper function to create a type model
516
517
  function createType(typeName) {
518
+ if (typeName in builtinDeprecated) {
519
+ return {'builtin': builtinDeprecated[typeName]};
520
+ }
517
521
  if (builtinTypes.has(typeName)) {
518
522
  return {'builtin': typeName};
519
523
  }
package/lib/schemaUtil.js CHANGED
@@ -57,7 +57,7 @@ export function validateTypeModelErrors(types) {
57
57
  // Check member type and attributes
58
58
  validateTypeModelType(errors, types, member.type, 'attr' in member ? member.attr : null, struct.name, member.name);
59
59
  }
60
- } catch (TypeError) {
60
+ } catch {
61
61
  errors.push([typeName, null, `Circular base type detected for type '${typeName}'`]);
62
62
  }
63
63
 
@@ -93,7 +93,7 @@ export function validateTypeModelErrors(types) {
93
93
  errors.push([typeName, valueName, `Redefinition of '${typeName}' value '${valueName}'`]);
94
94
  }
95
95
  }
96
- } catch (TypeError) {
96
+ } catch {
97
97
  errors.push([typeName, null, `Circular base type detected for type '${typeName}'`]);
98
98
  }
99
99
 
@@ -147,7 +147,7 @@ export function validateTypeModelErrors(types) {
147
147
  }
148
148
  memberSections[memberName].push(sectionStruct.name);
149
149
  }
150
- } catch (TypeError) {
150
+ } catch {
151
151
  // Do nothing
152
152
  }
153
153
  }
package/lib/typeModel.js CHANGED
@@ -91,8 +91,8 @@ enum BuiltinType
91
91
  # A UUID formatted as string
92
92
  uuid
93
93
 
94
- # An object of any type
95
- object
94
+ # An value of any type
95
+ any
96
96
 
97
97
 
98
98
  # An array type
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "schema-markdown",
4
- "version": "1.2.9",
4
+ "version": "1.2.10",
5
5
  "description": "A schema definition and validation library",
6
6
  "keywords": [
7
7
  "schema",
@@ -24,8 +24,8 @@
24
24
  "test": "node --test test/"
25
25
  },
26
26
  "devDependencies": {
27
- "c8": "~8.0",
28
- "eslint": "~8.52",
27
+ "c8": "~10.1",
28
+ "eslint": "~9.14",
29
29
  "jsdoc": "~4.0"
30
30
  }
31
31
  }