@famgia/omnify-cli 0.0.133 → 0.0.135

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