mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 18:25:24 +00:00
Removed basicStructure and boardingStructure in schema for passDict with common fields and transitType
This commit is contained in:
2
index.js
2
index.js
@@ -423,7 +423,7 @@ class Pass {
|
||||
let type = passTypes[index];
|
||||
|
||||
this.type = type;
|
||||
return schema.isValid(passFile[type], schema.constants[(type === "boardingPass" ? "boarding" : "basic") + "Structure"]);
|
||||
return schema.isValid(passFile[type], schema.constants.passDict);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
12
schema.js
12
schema.js
@@ -45,26 +45,22 @@ let locationsDict = Joi.object().keys({
|
||||
relevantText: Joi.string()
|
||||
});
|
||||
|
||||
let struct = {
|
||||
let passDict = Joi.object().keys({
|
||||
auxiliaryFields: Joi.array().items(field),
|
||||
backFields: Joi.array().items(field),
|
||||
headerFields: Joi.array().items(field),
|
||||
primaryFields: Joi.array().items(field),
|
||||
secondaryFields: Joi.array().items(field)
|
||||
};
|
||||
});
|
||||
|
||||
let basicStructure = Joi.object().keys(struct);
|
||||
let boardingStructure = Joi.object().keys(Object.assign({
|
||||
transitType: Joi.string().regex(/(PKTransitTypeAir|PKTransitTypeBoat|PKTransitTypeBus|PKTransitTypeGeneric|PKTransitTypeTrain)/).required()
|
||||
}, struct));
|
||||
let transitType = Joi.string().regex(/(PKTransitTypeAir|PKTransitTypeBoat|PKTransitTypeBus|PKTransitTypeGeneric|PKTransitTypeTrain)/);
|
||||
|
||||
module.exports = {
|
||||
constants: {
|
||||
instance,
|
||||
barcode,
|
||||
field,
|
||||
basicStructure,
|
||||
boardingStructure,
|
||||
passDict,
|
||||
beaconsDict,
|
||||
locationsDict,
|
||||
transitType
|
||||
|
||||
Reference in New Issue
Block a user