Website: Validate keys in pricing table configuration (#20826)

Closes: #20776

Changes:
- updated the build-static-content script to throw an error if a feature
in the pricing-features-table.yml contains an unrecognized key.

Note: The "Test Fleet website" GH action will fail until
https://github.com/fleetdm/fleet/pull/20825 is merged and this PR is
updated.
This commit is contained in:
Eric
2024-08-02 17:05:12 -05:00
committed by GitHub
parent 1d3c6f3a96
commit e790e56a06
+7
View File
@@ -804,7 +804,14 @@ module.exports = {
let pricingTableFeatures = YAML.parse(yaml, {prettyErrors: true});
let VALID_PRODUCT_CATEGORIES = ['Endpoint operations', 'Device management', 'Vulnerability management'];
let VALID_PRICING_TABLE_CATEGORIES = ['Support', 'Deployment', 'Integrations', 'Endpoint operations', 'Device management', 'Vulnerability management'];
let VALID_PRICING_TABLE_KEYS = ['industryName', 'description', 'documentationUrl', 'tier', 'jamfProHasFeature', 'jamfProtectHasFeature', 'usualDepartment', 'productCategories', 'pricingTableCategories', 'waysToUse', 'buzzwords', 'demos', 'dri', 'friendlyName', 'moreInfoUrl', 'comingSoonOn', 'screenshotSrc', 'isExperimental'];
for(let feature of pricingTableFeatures){
// Throw an error if a feature contains an unrecognized key.
for(let key of _.keys(feature)){
if(!VALID_PRICING_TABLE_KEYS.includes(key)){
throw new Error(`Unrecognized key. Could not build pricing table config from pricing-features-table.yml. The "${feature.industryName}" feature contains an unrecognized key (${key}). To resolve, fix any typos or remove this key and try running this script again.`);
}
}
if(feature.name) {// Compatibility check
throw new Error(`Could not build pricing table config from pricing-features-table.yml. A feature has a "name" (${feature.name}) which is no longer supported. To resolve, add a "industryName" to this feature: ${feature}`);
}