@twin.org/tools-core 0.0.3-next.20 → 0.0.3-next.21

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.
@@ -33,6 +33,16 @@ export declare class JsonSchemaBuilder {
33
33
  * @throws GeneralError Thrown when a tag key is not supported by IJsonSchema.
34
34
  */
35
35
  static applyJsonSchemaTags(schema: Partial<IJsonSchema>, node: ts.Node): void;
36
+ /**
37
+ * Validate that a @json-schema constraint key is compatible with the given schema type,
38
+ * and that the raw value is valid for the constraint.
39
+ * @param schemaKey The mapped schema key being applied.
40
+ * @param schemaType The type already set on the schema, if any.
41
+ * @param rawValue The raw string value from the JSDoc tag.
42
+ * @throws GeneralError Thrown when the constraint is not valid for the schema type.
43
+ * @throws GeneralError Thrown when the format value is not a recognised JSON Schema format.
44
+ */
45
+ static validateJsonSchemaTagConstraint(schemaKey: string, schemaType: string | string[] | undefined, rawValue: string): void;
36
46
  /**
37
47
  * Determine whether a mapped @json-schema tag key is supported.
38
48
  * @param key The mapped schema key.
package/docs/changelog.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.3-next.21](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.20...tools-core-v0.0.3-next.21) (2026-03-20)
4
+
5
+
6
+ ### Features
7
+
8
+ * add jsdoc tag validation ([971b8d3](https://github.com/twinfoundation/tools/commit/971b8d3817d40467bfd7549c99af602f0c590299))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/tools-models bumped from 0.0.3-next.20 to 0.0.3-next.21
16
+
3
17
  ## [0.0.3-next.20](https://github.com/twinfoundation/tools/compare/tools-core-v0.0.3-next.19...tools-core-v0.0.3-next.20) (2026-03-20)
4
18
 
5
19
 
@@ -100,6 +100,46 @@ GeneralError Thrown when a tag key is not supported by IJsonSchema.
100
100
 
101
101
  ***
102
102
 
103
+ ### validateJsonSchemaTagConstraint() {#validatejsonschematagconstraint}
104
+
105
+ > `static` **validateJsonSchemaTagConstraint**(`schemaKey`, `schemaType`, `rawValue`): `void`
106
+
107
+ Validate that a
108
+
109
+ #### Parameters
110
+
111
+ ##### schemaKey
112
+
113
+ `string`
114
+
115
+ The mapped schema key being applied.
116
+
117
+ ##### schemaType
118
+
119
+ `string` \| `string`[] \| `undefined`
120
+
121
+ The type already set on the schema, if any.
122
+
123
+ ##### rawValue
124
+
125
+ `string`
126
+
127
+ The raw string value from the JSDoc tag.
128
+
129
+ #### Returns
130
+
131
+ `void`
132
+
133
+ #### Throws
134
+
135
+ GeneralError Thrown when the constraint is not valid for the schema type.
136
+
137
+ #### Throws
138
+
139
+ GeneralError Thrown when the format value is not a recognised JSON Schema format.
140
+
141
+ ***
142
+
103
143
  ### isAllowedJsonSchemaTagKey() {#isallowedjsonschematagkey}
104
144
 
105
145
  > `static` **isAllowedJsonSchemaTagKey**(`key`): `boolean`
package/locales/en.json CHANGED
@@ -2,6 +2,8 @@
2
2
  "error": {
3
3
  "jsonSchemaBuilder": {
4
4
  "invalidJsonSchemaTagKey": "Ignoring invalid @json-schema tag key \"{rawKey}\". Mapped key \"{schemaKey}\" is not supported by JSON Schema.",
5
+ "constraintOnIncompatibleType": "The @json-schema \"{schemaKey}\" constraint requires type \"{requiredType}\" but the type is \"{schemaType}\".",
6
+ "invalidFormatValue": "The @json-schema \"format\" value \"{formatValue}\" is not a recognised JSON Schema format. Valid values are: {validFormats}.",
5
7
  "missingTypeReferenceSchema": "Unable to resolve type \"{typeName}\"{importSource} required as base type for utility type. Ensure the type is in the configured packages list or its external package exports TypeScript source files that can be parsed via the AST."
6
8
  }
7
9
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/tools-core",
3
- "version": "0.0.3-next.20",
3
+ "version": "0.0.3-next.21",
4
4
  "description": "Shared utilities and models for tooling packages",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@twin.org/core": "next",
18
18
  "@twin.org/nameof": "next",
19
- "@twin.org/tools-models": "0.0.3-next.20",
19
+ "@twin.org/tools-models": "0.0.3-next.21",
20
20
  "glob": "13.0.6"
21
21
  },
22
22
  "main": "./dist/es/index.js",