@ghentcdh/crouton-api 0.0.1-alpha.73 → 0.0.1-alpha.75

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
@@ -878,14 +878,18 @@ var ColumnTypeShorthandSchema = import_zod11.z.enum([
878
878
  var JsonSchemaFragmentSchema = import_zod11.z.lazy(() => import_zod11.z.object({
879
879
  type: import_zod11.z.union([
880
880
  import_zod11.z.string(),
881
- import_zod11.z.array(import_zod11.z.string())
881
+ import_zod11.z.array(import_zod11.z.string()),
882
+ import_zod11.z.lazy(() => JsonSchemaFragmentSchema)
882
883
  ]).optional(),
883
884
  format: import_zod11.z.string().optional(),
884
885
  enum: import_zod11.z.array(import_zod11.z.unknown()).optional(),
885
886
  const: import_zod11.z.unknown().optional(),
886
887
  nullable: import_zod11.z.boolean().optional(),
887
888
  properties: import_zod11.z.record(import_zod11.z.string(), JsonSchemaFragmentSchema).optional(),
888
- required: import_zod11.z.array(import_zod11.z.string()).optional(),
889
+ required: import_zod11.z.union([
890
+ import_zod11.z.array(import_zod11.z.string()),
891
+ import_zod11.z.boolean()
892
+ ]).optional(),
889
893
  items: JsonSchemaFragmentSchema.optional(),
890
894
  additionalProperties: import_zod11.z.union([
891
895
  import_zod11.z.boolean(),
@@ -948,11 +952,33 @@ var normalizeFragment = /* @__PURE__ */ __name((fragment) => {
948
952
  if (out.format === void 0) out.format = expanded.format;
949
953
  }
950
954
  }
955
+ if (out.type && typeof out.type === "object" && !Array.isArray(out.type)) {
956
+ Object.assign(out, out.type);
957
+ }
951
958
  if (out.properties) {
952
- out.properties = Object.fromEntries(Object.entries(out.properties).map(([key, value]) => [
953
- key,
954
- normalizeFragment(value)
955
- ]));
959
+ const existingRequired = Array.isArray(out.required) ? out.required : [];
960
+ const hoistedRequired = [
961
+ ...existingRequired
962
+ ];
963
+ out.properties = Object.fromEntries(Object.entries(out.properties).map(([key, value]) => {
964
+ let v = {
965
+ ...value
966
+ };
967
+ if (v.required === true) {
968
+ hoistedRequired.push(key);
969
+ const { required: _r, ...rest } = v;
970
+ v = rest;
971
+ }
972
+ return [
973
+ key,
974
+ normalizeFragment(v)
975
+ ];
976
+ }));
977
+ if (hoistedRequired.length > 0) {
978
+ out.required = hoistedRequired;
979
+ } else {
980
+ delete out.required;
981
+ }
956
982
  }
957
983
  if (out.items) out.items = normalizeFragment(out.items);
958
984
  if (out.additionalProperties && typeof out.additionalProperties === "object") {