@makehq/forman-schema 1.3.3 → 1.3.4
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 +11 -2
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -90,6 +90,7 @@ var FORMAN_TYPE_MAP = {
|
|
|
90
90
|
udt: "number",
|
|
91
91
|
array: "array",
|
|
92
92
|
collection: "object",
|
|
93
|
+
dynamicCollection: "object",
|
|
93
94
|
text: "string",
|
|
94
95
|
number: "number",
|
|
95
96
|
boolean: "boolean",
|
|
@@ -154,6 +155,7 @@ function toJSONSchemaInternal(field, context = createDefaultContext()) {
|
|
|
154
155
|
};
|
|
155
156
|
switch (normalizedField.type) {
|
|
156
157
|
case "collection":
|
|
158
|
+
case "dynamicCollection":
|
|
157
159
|
return handleCollectionType(normalizedField, result, context);
|
|
158
160
|
case "array":
|
|
159
161
|
return handleArrayType(normalizedField, result, context);
|
|
@@ -845,12 +847,19 @@ var JSON_PRIMITIVE_TYPE_MAP = {
|
|
|
845
847
|
function toFormanSchema(field) {
|
|
846
848
|
switch (field.type) {
|
|
847
849
|
case "object":
|
|
848
|
-
|
|
850
|
+
if (!field.properties || !Object.entries(field.properties).length) {
|
|
851
|
+
return {
|
|
852
|
+
type: "dynamicCollection",
|
|
853
|
+
label: noEmpty(field.title),
|
|
854
|
+
help: noEmpty(field.description)
|
|
855
|
+
};
|
|
856
|
+
}
|
|
857
|
+
const spec = Object.entries(field.properties).filter(([name, property]) => !!property).map(([name, property]) => {
|
|
849
858
|
const subField = toFormanSchema(property);
|
|
850
859
|
subField.name = name;
|
|
851
860
|
subField.required = field.required?.includes(name) || false;
|
|
852
861
|
return subField;
|
|
853
|
-
})
|
|
862
|
+
});
|
|
854
863
|
return {
|
|
855
864
|
type: "collection",
|
|
856
865
|
label: noEmpty(field.title),
|
package/dist/index.js
CHANGED
|
@@ -61,6 +61,7 @@ var FORMAN_TYPE_MAP = {
|
|
|
61
61
|
udt: "number",
|
|
62
62
|
array: "array",
|
|
63
63
|
collection: "object",
|
|
64
|
+
dynamicCollection: "object",
|
|
64
65
|
text: "string",
|
|
65
66
|
number: "number",
|
|
66
67
|
boolean: "boolean",
|
|
@@ -125,6 +126,7 @@ function toJSONSchemaInternal(field, context = createDefaultContext()) {
|
|
|
125
126
|
};
|
|
126
127
|
switch (normalizedField.type) {
|
|
127
128
|
case "collection":
|
|
129
|
+
case "dynamicCollection":
|
|
128
130
|
return handleCollectionType(normalizedField, result, context);
|
|
129
131
|
case "array":
|
|
130
132
|
return handleArrayType(normalizedField, result, context);
|
|
@@ -816,12 +818,19 @@ var JSON_PRIMITIVE_TYPE_MAP = {
|
|
|
816
818
|
function toFormanSchema(field) {
|
|
817
819
|
switch (field.type) {
|
|
818
820
|
case "object":
|
|
819
|
-
|
|
821
|
+
if (!field.properties || !Object.entries(field.properties).length) {
|
|
822
|
+
return {
|
|
823
|
+
type: "dynamicCollection",
|
|
824
|
+
label: noEmpty(field.title),
|
|
825
|
+
help: noEmpty(field.description)
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
const spec = Object.entries(field.properties).filter(([name, property]) => !!property).map(([name, property]) => {
|
|
820
829
|
const subField = toFormanSchema(property);
|
|
821
830
|
subField.name = name;
|
|
822
831
|
subField.required = field.required?.includes(name) || false;
|
|
823
832
|
return subField;
|
|
824
|
-
})
|
|
833
|
+
});
|
|
825
834
|
return {
|
|
826
835
|
type: "collection",
|
|
827
836
|
label: noEmpty(field.title),
|