fhirbuilder
Version:
Another FHIR Tool to build FHIR Resources
36 lines (35 loc) • 1.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocationPositionValidator = LocationPositionValidator;
const definitions_1 = require("../base/definitions");
const base_1 = require("../base");
const utils_1 = require("../../../commons/utils");
const models_1 = require("../../../../r4/models");
/**
* @description The model fields for the LocationPosition model
*/
const modelFields = (0, definitions_1.createBackboneDefinition)([
{ name: 'longitude', type: 'decimal', isArray: false, isRequired: true },
{ name: '_longitude', type: 'Element', isArray: false, isRequired: false },
{ name: 'latitude', type: 'decimal', isArray: false, isRequired: true },
{ name: '_latitude', type: 'Element', isArray: false, isRequired: false },
{ name: 'altitude', type: 'decimal', isArray: false, isRequired: false },
{ name: '_altitude', type: 'Element', isArray: false, isRequired: false },
]);
/**
* @description Validates the LocationPosition model
* @param dataToValidate - the LocationPosition model to validate
* @param path - the path to the model
* @param errors - the errors array
*/
function LocationPositionValidator(dataToValidate, path = 'LocationPosition', errors = []) {
// Ensure that the model fields match the attributes of the model
(0, utils_1.AssertModelFieldsMatchAttributes)(modelFields, new models_1.LocationPosition());
// Validate the model and add any errors to the errors array
(0, base_1.ModelValidator)({
dataToValidate,
modelDefinition: modelFields,
path,
errors,
});
}