@tsofist/schema-forge 4.2.1 → 4.2.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"generate-schema.d.ts","sourceRoot":"","sources":["../../src/schema-generator/generate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAMvC,OAAO,EAIH,eAAe,EAqBlB,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,EAAwB,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAOlF;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAoGhG;AAiKD,UAAU,eAAgB,SAAQ,kBAAkB;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,2BAA2B,EAAE,eAAe,CAAC;CAChD"}
1
+ {"version":3,"file":"generate-schema.d.ts","sourceRoot":"","sources":["../../src/schema-generator/generate-schema.ts"],"names":[],"mappings":"AAAA,OAAO,+BAA+B,CAAC;AAMvC,OAAO,EAIH,eAAe,EAqBlB,MAAM,0BAA0B,CAAC;AAgBlC,OAAO,EAAwB,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAOlF;;GAEG;AACH,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC,CAoGhG;AAgLD,UAAU,eAAgB,SAAQ,kBAAkB;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,2BAA2B,EAAE,eAAe,CAAC;CAChD"}
@@ -235,15 +235,28 @@ class SchemaGeneratorEx extends ts_json_schema_generator_1.SchemaGenerator {
235
235
  tslib_1.__classPrivateFieldSet(this, _SchemaGeneratorEx_multipleDefinitionsErrorSuppression, value, "f");
236
236
  }
237
237
  appendRootChildDefinitions(rootType, childDefinitions) {
238
- try {
239
- super.appendRootChildDefinitions(rootType, childDefinitions);
238
+ if (tslib_1.__classPrivateFieldGet(this, _SchemaGeneratorEx_multipleDefinitionsErrorSuppression, "f")) {
239
+ const seen = new Set();
240
+ const children = this.typeFormatter
241
+ .getChildren(rootType)
242
+ .filter((child) => child instanceof ts_json_schema_generator_1.DefinitionType)
243
+ .filter((child) => {
244
+ if (!seen.has(child.getId())) {
245
+ seen.add(child.getId());
246
+ return true;
247
+ }
248
+ return false;
249
+ });
250
+ children.reduce((definitions, child) => {
251
+ const name = child.getName();
252
+ if (!(name in definitions)) {
253
+ definitions[name] = this.typeFormatter.getDefinition(child.getType());
254
+ }
255
+ return definitions;
256
+ }, childDefinitions);
240
257
  }
241
- catch (e) {
242
- if (e instanceof ts_json_schema_generator_1.MultipleDefinitionsError) {
243
- if (tslib_1.__classPrivateFieldGet(this, _SchemaGeneratorEx_multipleDefinitionsErrorSuppression, "f"))
244
- return;
245
- }
246
- throw e;
258
+ else {
259
+ super.appendRootChildDefinitions(rootType, childDefinitions);
247
260
  }
248
261
  }
249
262
  }
@@ -1 +1 @@
1
- {"version":3,"file":"kw-common.d.ts","sourceRoot":"","sources":["../../src/schema-registry/kw-common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAQ7C,eAAO,MAAM,iBAAiB,EAAE,SAAS,iBAAiB,EA2FtD,CAAC"}
1
+ {"version":3,"file":"kw-common.d.ts","sourceRoot":"","sources":["../../src/schema-registry/kw-common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,KAAK,CAAC;AAO7C,eAAO,MAAM,iBAAiB,EAAE,SAAS,iBAAiB,EA2FtD,CAAC"}
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SFRCommonKeywords = void 0;
4
4
  const FakerModulePattern = '^[a-zA-Z.]+$';
5
5
  const NP_ENUM_KEY = '^[a-zA-Z0-9-\\._]+$';
6
- const NP_ENUM_VALUE = '^[a-zA-Z0-9-\\._:]+$';
7
6
  exports.SFRCommonKeywords = [
8
7
  {
9
8
  keyword: 'version',
@@ -55,7 +54,7 @@ exports.SFRCommonKeywords = [
55
54
  minItems: 1,
56
55
  maxItems: 3,
57
56
  items: [
58
- { title: 'value', type: ['string', 'number'], pattern: NP_ENUM_VALUE },
57
+ { title: 'value', type: ['string', 'number'] },
59
58
  { title: 'note', type: 'string' },
60
59
  { title: 'comment', type: 'string' },
61
60
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsofist/schema-forge",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "Generate JSON schema from TypeScript types",
5
5
  "author": "Andrew Berdnikov <tsofistgudmen@gmail.com>",
6
6
  "license": "LGPL-3.0",