@semiont/backend 0.2.40 → 0.2.41

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
@@ -3662,15 +3662,35 @@ var getValidatorLogger = /* @__PURE__ */ __name(() => getLogger().child({
3662
3662
  var ajv = new Ajv({
3663
3663
  allErrors: true,
3664
3664
  coerceTypes: true,
3665
- removeAdditional: false
3665
+ removeAdditional: false,
3666
+ keywords: [
3667
+ "example"
3668
+ ]
3666
3669
  });
3667
3670
  addFormats(ajv);
3671
+ function convertNullable(obj) {
3672
+ if (obj === null || obj === void 0 || typeof obj !== "object") return;
3673
+ const record = obj;
3674
+ if (record.nullable === true && typeof record.type === "string") {
3675
+ record.type = [
3676
+ record.type,
3677
+ "null"
3678
+ ];
3679
+ delete record.nullable;
3680
+ }
3681
+ for (const v of Object.values(record)) {
3682
+ if (typeof v === "object") convertNullable(v);
3683
+ }
3684
+ }
3685
+ __name(convertNullable, "convertNullable");
3668
3686
  var schemasLoaded = false;
3669
3687
  function loadSchemas() {
3670
3688
  if (schemasLoaded) return;
3671
3689
  for (const [name, schema] of Object.entries(openapi_default.components.schemas)) {
3672
3690
  try {
3673
- ajv.addSchema(schema, `#/components/schemas/${name}`);
3691
+ const converted = structuredClone(schema);
3692
+ convertNullable(converted);
3693
+ ajv.addSchema(converted, `#/components/schemas/${name}`);
3674
3694
  } catch (error) {
3675
3695
  getValidatorLogger().error("Failed to load schema", {
3676
3696
  schemaName: name,