diff --git a/index.js b/index.js index 21cd6bd..85fce29 100644 --- a/index.js +++ b/index.js @@ -21,9 +21,11 @@ const companies = require(pathForJson('company_ids')); const services = require(pathForJson('service_uuids')); const characteristics = require(pathForJson('characteristic_uuids')); const descriptors = require(pathForJson('descriptor_uuids')); +const appearances = require(pathForJson('gap_appearance')); const companySchema = require(pathForJson('company_schema')); const attributeSchema = require(pathForJson('attribute_schema')); +const appearanceSchema = require(pathForJson('appearance_schema')); module.exports = { version, @@ -31,10 +33,12 @@ module.exports = { services, characteristics, descriptors, + appearances, schemas: { companies: companySchema, services: attributeSchema, characteristics: attributeSchema, descriptors: attributeSchema, + appearances: appearanceSchema } }; diff --git a/v1/appearance_schema.json b/v1/appearance_schema.json new file mode 100644 index 0000000..8b9cb4c --- /dev/null +++ b/v1/appearance_schema.json @@ -0,0 +1,27 @@ +{ + "type": "array", + "items": { + "type": "object", + "properties": { + "category": { + "type": "string", + "pattern": "^[0-9A-Fa-f]+$" + }, + "name": { + "type": "string" + }, + "subcategory": { + "type": "array", + "items": { + "type": "object", + "properties": { + "value": { "type": "string" }, + "name": { "type": "string" } + }, + "required": ["value", "name"] + } + } + }, + "required": ["category", "name"] + } +} diff --git a/verify.js b/verify.js index 6600169..217f8c5 100644 --- a/verify.js +++ b/verify.js @@ -22,6 +22,14 @@ const noDuplicates = Object.keys(db) let companyCodes = db[list].map(company => company.code); numberOfItems = companyCodes.length; numberOfUniques = (new Set(companyCodes)).size; + } else if (list == 'appearances') { + let appearances = db[list].map(appearance => appearance.category); + numberOfItems = appearances.length; + numberOfUniques = (new Set(appearances)).size; + if (numberOfItems != numberOfUniques) { + console.error(`Failed to verify '${list}'. Found '${numberOfItems - numberOfUniques}' duplicate items.`); + return false; + } } else { // GATT Attributes let uuids = db[list].map(gatt => gatt.uuid);