@tsed/schema 8.26.1 → 8.27.0

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.
@@ -1458,6 +1458,20 @@ export class JsonSchema extends Map {
1458
1458
  return item;
1459
1459
  }
1460
1460
  mapGenerics(jsonSchema, generics) {
1461
+ if (!(jsonSchema instanceof JsonSchema)) {
1462
+ console.warn("[@tsed/schema] The model likely contains an invalid generic declaration. " +
1463
+ "A JsonSchema instance was expected, but a different value was resolved. " +
1464
+ "Check your GenericOf/Nested declaration (or functional API usage).", {
1465
+ context: {
1466
+ schemaName: this.getName(),
1467
+ propertyKey: this.getPropertyKey(),
1468
+ target: nameOf(this.getTarget())
1469
+ },
1470
+ generics,
1471
+ resolvedValue: jsonSchema
1472
+ });
1473
+ return {};
1474
+ }
1461
1475
  const genericLabels = jsonSchema.getGenericLabels();
1462
1476
  if (!genericLabels) {
1463
1477
  return {};
@@ -20,11 +20,11 @@ import type { Infer, PropsToShape, SchemaKey, SchemaMerge, SchemaOmit, SchemaPar
20
20
  * @public
21
21
  */
22
22
  export interface JsonSchemaObject extends Omit<JSONSchema7, "type" | "additionalProperties" | "items" | "pattern"> {
23
- [key: `x-${string}`]: unknown;
24
23
  type?: JSONSchema7["type"] | Type | null | (String | null | Date | Number | Object | Boolean)[];
25
24
  additionalProperties?: JsonSchemaObject | boolean | Type | JsonSchema;
26
25
  items?: JsonSchemaObject | boolean | Type | JsonSchema | (JsonSchemaObject | Type | JsonSchema)[];
27
26
  pattern?: string | RegExp;
27
+ [key: `x-${string}`]: unknown;
28
28
  }
29
29
  /**
30
30
  * Union type representing any valid JSON schema representation.
@@ -817,6 +817,6 @@ export declare class JsonSchema<T = JSONSchema7Type> extends Map<string, any> {
817
817
  protected setManyOf(keyword: "oneOf" | "anyOf" | "allOf", value: (AnyJsonSchema | null)[]): this | undefined;
818
818
  protected mapToJsonSchema(item: any[]): JsonSchema[];
819
819
  protected mapToJsonSchema(item: any): JsonSchema;
820
- protected mapGenerics(jsonSchema: JsonSchema, generics: GenericValue[][]): GenericsMap;
820
+ protected mapGenerics(jsonSchema: unknown, generics: GenericValue[][]): GenericsMap;
821
821
  protected mapProperties(properties: Record<string, any>): any;
822
822
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tsed/schema",
3
3
  "description": "JsonSchema module for Ts.ED Framework",
4
4
  "type": "module",
5
- "version": "8.26.1",
5
+ "version": "8.27.0",
6
6
  "source": "./src/index.ts",
7
7
  "main": "./lib/esm/index.js",
8
8
  "module": "./lib/esm/index.js",
@@ -34,7 +34,7 @@
34
34
  "tsed"
35
35
  ],
36
36
  "dependencies": {
37
- "@tsed/openspec": "8.26.1",
37
+ "@tsed/openspec": "8.27.0",
38
38
  "change-case": "^5.4.4",
39
39
  "json-schema": "0.4.0",
40
40
  "picomatch": "4.0.4",
@@ -43,11 +43,11 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@apidevtools/swagger-parser": "10.1.0",
46
- "@tsed/barrels": "8.26.1",
47
- "@tsed/core": "8.26.1",
48
- "@tsed/hooks": "8.26.1",
49
- "@tsed/openspec": "8.26.1",
50
- "@tsed/typescript": "8.26.1",
46
+ "@tsed/barrels": "8.27.0",
47
+ "@tsed/core": "8.27.0",
48
+ "@tsed/hooks": "8.27.0",
49
+ "@tsed/openspec": "8.27.0",
50
+ "@tsed/typescript": "8.27.0",
51
51
  "@types/fs-extra": "11.0.4",
52
52
  "@types/json-schema": "7.0.15",
53
53
  "@types/picomatch": "3.0.2",
@@ -55,7 +55,7 @@
55
55
  "ajv": "^8.17.1",
56
56
  "eslint": "9.12.0",
57
57
  "typescript": "6.0.2",
58
- "vitest": "3.2.4"
58
+ "vitest": "4.1.4"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tsed/core": ">=8.0.0",