osury 0.25.0 → 0.26.0
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/package.json +1 -1
- package/src/IRGen.res.mjs +22 -9
package/package.json
CHANGED
package/src/IRGen.res.mjs
CHANGED
|
@@ -48,10 +48,15 @@ function convertType(schema) {
|
|
|
48
48
|
_0: convertType(schema._0)
|
|
49
49
|
};
|
|
50
50
|
case "Object" :
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
51
|
+
let fields = schema._0;
|
|
52
|
+
if (fields.length === 0) {
|
|
53
|
+
return "JSON";
|
|
54
|
+
} else {
|
|
55
|
+
return {
|
|
56
|
+
TAG: "InlineRecord",
|
|
57
|
+
_0: fields.map(convertField)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
55
60
|
case "Array" :
|
|
56
61
|
return {
|
|
57
62
|
TAG: "Array",
|
|
@@ -258,13 +263,21 @@ function convertToIrTypeDef(namedSchema, schemasDict, tagsDict, skipSchemaSet) {
|
|
|
258
263
|
}
|
|
259
264
|
let fields = namedSchema.schema;
|
|
260
265
|
let kind;
|
|
261
|
-
|
|
266
|
+
if (typeof fields !== "object" || fields._tag !== "Object") {
|
|
267
|
+
kind = {
|
|
262
268
|
TAG: "AliasDef",
|
|
263
269
|
_0: convertType(namedSchema.schema)
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
270
|
+
};
|
|
271
|
+
} else {
|
|
272
|
+
let fields$1 = fields._0;
|
|
273
|
+
kind = fields$1.length > 0 ? ({
|
|
274
|
+
TAG: "RecordDef",
|
|
275
|
+
_0: fields$1.map(convertField)
|
|
276
|
+
}) : ({
|
|
277
|
+
TAG: "AliasDef",
|
|
278
|
+
_0: convertType(namedSchema.schema)
|
|
279
|
+
});
|
|
280
|
+
}
|
|
268
281
|
let annotations = shouldSkipSchema ? ["GenType"] : [
|
|
269
282
|
"GenType",
|
|
270
283
|
"Schema"
|