@hestia-earth/schema-convert 7.7.1 → 7.8.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/json.js +5 -2
- package/package.json +1 -1
package/json.js
CHANGED
|
@@ -194,10 +194,13 @@ var handleArrayError = function (func) { return function (value, index) {
|
|
|
194
194
|
}; };
|
|
195
195
|
/**
|
|
196
196
|
* If the user provided a non-object where an object was expected, assume it was meant to be the `name` property.
|
|
197
|
+
* For non-Terms, we assume it is the `id`.
|
|
197
198
|
*
|
|
198
199
|
* @param value The value mapped as a Ref
|
|
199
200
|
*/
|
|
200
|
-
var schemaRefValue = function (value) {
|
|
201
|
+
var schemaRefValue = function (value, schemaType) {
|
|
202
|
+
return typeof value === 'object' ? value : schemaType === schema_1.SchemaType.Term ? { name: value } : { id: value };
|
|
203
|
+
};
|
|
201
204
|
exports.cleanStringValue = function (value) { return (value.match(/^[\d]+\.[\d]+\.[\d]+$/) === null ? value.replace(/\.0$/, '') : value).trim(); };
|
|
202
205
|
var propertyTypeToValue = {
|
|
203
206
|
null: function (value) {
|
|
@@ -248,7 +251,7 @@ var propertyTypeToValue = {
|
|
|
248
251
|
var $ref = _a.$ref;
|
|
249
252
|
var schemaType = schema_1.refToSchemaType($ref);
|
|
250
253
|
var schema = schemaType ? schemas[schemaType] : undefined;
|
|
251
|
-
var data = schema ? mapContent(schemas, schema, _i)(schemaRefValue(value)) : safeParseJSON(value);
|
|
254
|
+
var data = schema ? mapContent(schemas, schema, _i)(schemaRefValue(value, schemaType)) : safeParseJSON(value);
|
|
252
255
|
return utils_1.isEmpty(data) ? {} : (schema ? extendDataFromSchema(data, schema, schemaType, _i) : data);
|
|
253
256
|
}
|
|
254
257
|
};
|