swoop-common 2.1.57 → 2.1.58

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.
@@ -19,7 +19,7 @@ export const generateJsonSchema = (formSchema, stage, onlyEditableFields) => {
19
19
  return;
20
20
  const fieldSchema = defaultConverter(s, stage);
21
21
  built.properties[generateFieldId(s.name)] = fieldSchema;
22
- if (s.required)
22
+ if (s.required && s.fieldType !== "boolean")
23
23
  built.required.push(generateFieldId(s.name));
24
24
  });
25
25
  return built;
@@ -49,7 +49,8 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
49
49
  for (const child of (_d = (_c = field.objectOptions) === null || _c === void 0 ? void 0 : _c.properties) !== null && _d !== void 0 ? _d : []) {
50
50
  const fieldId = generateFieldId(child.name);
51
51
  properties[fieldId] = defaultConverter(child, stage, false, true);
52
- if (child.required && child.fieldType !== "boolean")
52
+ console.log("FILD TYPE", child.fieldType, "REWQUIRED", child.required);
53
+ if (child.required && child.fieldType != "boolean")
53
54
  requiredFields.push(fieldId);
54
55
  }
55
56
  let enumOpts = field.fieldType === "enum"
@@ -77,8 +78,6 @@ const defaultConverter = (field, stage, omitTitle, isChild) => {
77
78
  ? { "x-templateIds": field.componentOptions["x-templateIds"] }
78
79
  : {};
79
80
  let title = omitTitle ? undefined : field.name;
80
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (!isChild &&
81
- !(Array.isArray(field.editableIn) ? field.editableIn : [])
82
- .map(Number)
83
- .includes(stage) && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), (field.fieldType === "object" && { required: requiredFields })), (enumOpts && { enum: enumOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties })), (field.fieldType === "string" && Object.assign({}, field.stringOptions)));
81
+ let isReadonly = !isChild && !field.editableIn.map(Number).includes(stage);
82
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (isReadonly && { readOnly: true })), { title, type: schema.schema.type, "x-type": schema.schema["x-type"] }), templates), (schema.schema.type === "object" && { properties })), (field.fieldType === "object" && { required: requiredFields })), (enumOpts && { enum: enumOpts })), (stagedEnumOpts && { items: { enum: stagedEnumOpts, type: "string" } })), (arrayItems && { items: arrayItems })), (field.fieldType === "object" && { properties })), (field.fieldType === "string" && Object.assign({}, field.stringOptions)));
84
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.1.57",
3
+ "version": "2.1.58",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {