@famgia/omnify-core 0.0.144 → 0.0.145

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.cjs CHANGED
@@ -1036,21 +1036,15 @@ function mergePartialSchemas(schemas, partials) {
1036
1036
  return priorityA - priorityB;
1037
1037
  });
1038
1038
  for (const partial of partialSchemas) {
1039
- const targetName = partial.target;
1040
- if (!targetName) {
1041
- console.warn(`Partial schema '${partial.name}' has no target, skipping`);
1042
- continue;
1043
- }
1039
+ const targetName = partial.name;
1044
1040
  const target = cleanSchemas[targetName];
1045
1041
  if (!target) {
1046
- if (partial.name === targetName) {
1047
- cleanSchemas[partial.name] = {
1048
- ...partial,
1049
- kind: "object"
1050
- };
1051
- continue;
1052
- }
1053
- console.warn(`Partial schema '${partial.name}' targets unknown schema '${targetName}', skipping`);
1042
+ cleanSchemas[targetName] = {
1043
+ ...partial,
1044
+ name: targetName,
1045
+ // Use target name, not partial's filename-derived name
1046
+ kind: "object"
1047
+ };
1054
1048
  continue;
1055
1049
  }
1056
1050
  const mergedProperties = {
@@ -3332,23 +3326,6 @@ function validatePartialSchema(schema, filePath) {
3332
3326
  if (schema.kind !== "partial") {
3333
3327
  return errors;
3334
3328
  }
3335
- if (!schema.target) {
3336
- errors.push(
3337
- validationError(
3338
- "Partial schema requires a target schema name",
3339
- buildLocation7(filePath),
3340
- "Add target: SchemaName to specify which schema to extend"
3341
- )
3342
- );
3343
- } else if (typeof schema.target !== "string") {
3344
- errors.push(
3345
- validationError(
3346
- "Partial schema target must be a string",
3347
- buildLocation7(filePath),
3348
- "Example: target: User"
3349
- )
3350
- );
3351
- }
3352
3329
  if (schema.priority !== void 0) {
3353
3330
  if (typeof schema.priority !== "number") {
3354
3331
  errors.push(
@@ -3623,29 +3600,6 @@ function validateSchemas(schemas, options = {}) {
3623
3600
  }
3624
3601
  }
3625
3602
  }
3626
- for (const schema of Object.values(schemas)) {
3627
- if (schema.kind === "partial" && schema.target) {
3628
- const targetExists = schemas[schema.target] !== void 0;
3629
- if (!targetExists) {
3630
- const error = validationError(
3631
- `Partial schema '${schema.name}' targets non-existent schema '${schema.target}'`,
3632
- buildLocation7(schema.filePath),
3633
- `Available schemas: ${Object.keys(schemas).filter((n) => n !== schema.name).join(", ")}`
3634
- );
3635
- allErrors.push(error);
3636
- const existingResult = schemaResults.find((r) => r.schemaName === schema.name);
3637
- if (existingResult) {
3638
- const updatedResult = {
3639
- ...existingResult,
3640
- valid: false,
3641
- errors: [...existingResult.errors, error]
3642
- };
3643
- const index = schemaResults.indexOf(existingResult);
3644
- schemaResults[index] = updatedResult;
3645
- }
3646
- }
3647
- }
3648
- }
3649
3603
  return {
3650
3604
  valid: allErrors.length === 0,
3651
3605
  errorCount: allErrors.length,