@rhoas/spectral-ruleset
Version:
33 lines • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (targetVal, _, context) => {
let p = ['info'];
if (!targetVal) {
return [
{
message: "OpenAPI `license` object is required.",
path: p
}
];
}
const results = [];
const expectName = 'Apache 2.0';
if (context.path[1] != undefined) {
p = context.path[1];
}
if ((targetVal === null || targetVal === void 0 ? void 0 : targetVal.name) != expectName) {
results.push({
message: '`name` must be "' + expectName + '"',
path: p
});
}
const expectUrl = 'https://www.apache.org/licenses/LICENSE-2.0';
if ((targetVal === null || targetVal === void 0 ? void 0 : targetVal.url) !== expectUrl) {
results.push({
message: '`url` must be "' + expectUrl + '" not "' + (targetVal === null || targetVal === void 0 ? void 0 : targetVal.url) + '"',
path: p
});
}
return results;
};
//# sourceMappingURL=infoLicenseApache2.js.map