@famgia/omnify-cli 0.0.133 → 0.0.134

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/dist/cli.js CHANGED
@@ -879,6 +879,7 @@ import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as wr
879
879
  import { resolve as resolve7, dirname as dirname5, relative } from "path";
880
880
  import {
881
881
  loadSchemas as loadSchemas3,
882
+ mergePartialSchemas,
882
883
  validateSchemas as validateSchemas3,
883
884
  OmnifyError as OmnifyError4,
884
885
  PluginManager,
@@ -1483,22 +1484,28 @@ async function runGenerate(options) {
1483
1484
  let schemas = await loadSchemas3(schemaPath);
1484
1485
  logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
1485
1486
  const additionalPaths = await loadRegisteredSchemaPaths(rootDir);
1487
+ let hasPackageSchemas = false;
1486
1488
  if (additionalPaths.length > 0) {
1487
1489
  logger.step(`Loading schemas from ${additionalPaths.length} registered path(s)`);
1488
1490
  for (const entry of additionalPaths) {
1489
1491
  const absolutePath = resolve7(rootDir, entry.path);
1490
1492
  logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
1491
1493
  if (existsSync5(absolutePath)) {
1492
- const packageSchemas = await loadSchemas3(absolutePath);
1493
- const count = Object.keys(packageSchemas).length;
1494
- logger.info(` \u2022 ${entry.path}: ${count} schema(s)`);
1494
+ const packageSchemas = await loadSchemas3(absolutePath, { skipPartialResolution: true });
1495
+ const count = Object.keys(packageSchemas).filter((k) => !k.startsWith("__partial__")).length;
1496
+ const partialCount = Object.keys(packageSchemas).filter((k) => k.startsWith("__partial__")).length;
1497
+ logger.info(` \u2022 ${entry.path}: ${count} schema(s)${partialCount > 0 ? ` + ${partialCount} partial(s)` : ""}`);
1495
1498
  schemas = { ...packageSchemas, ...schemas };
1499
+ hasPackageSchemas = true;
1496
1500
  } else {
1497
1501
  logger.warn(` \u2022 ${entry.path}: directory not found (skipped)`);
1498
1502
  logger.debug(` Resolved path: ${absolutePath}`);
1499
1503
  }
1500
1504
  }
1501
1505
  }
1506
+ if (hasPackageSchemas) {
1507
+ schemas = mergePartialSchemas(schemas);
1508
+ }
1502
1509
  const schemaCount = Object.keys(schemas).length;
1503
1510
  if (schemaCount === 0) {
1504
1511
  logger.warn("No schema files found");