1
0
Fork 0

Ignore manifest field (#5158)

This commit is contained in:
Alan Plum 2018-04-20 12:54:40 +02:00 committed by Michael Hackstein
parent a566ff6e73
commit cbd9fce10f
3 changed files with 25 additions and 3 deletions

View File

@ -27,13 +27,13 @@ v3.3.8 (XXXX-XX-XX)
- populated: database directory must exist and contain specific files already
- any: any state allowed
* field "$schema" in Foxx manifest.json files no longer produce warnings
* added `@arangodb/locals` module to expose the Foxx service context as an
alternative to using `module.context` directly.
* supervision can be put into maintenance mode
v3.3.7 (2018-04-11)
-------------------

View File

@ -196,7 +196,7 @@ function checkManifest (filename, inputManifest, mount, complainAboutVersionMism
}
for (const key of Object.keys(inputManifest)) {
if (manifestSchema[key]) {
if (manifestSchema[key] || key === '$schema') {
continue;
}
manifest[key] = inputManifest[key];
@ -347,3 +347,4 @@ function validateManifestFile (filename, mount, complainAboutVersionMismatches)
exports.configTypes = configTypes;
exports.validate = validateManifestFile;
exports.validateJson = checkManifest;

View File

@ -0,0 +1,21 @@
/*global describe, it */
'use strict';
const expect = require('chai').expect;
const validateManifest = require('@arangodb/foxx/manifest').validateJson;
const request = require('@arangodb/request');
const db = require('@arangodb').db;
describe('Foxx manifest $schema field', () => {
it('is ignored', () => {
const BAD_VALUE = 'http://badvalue.not/to/log';
let manifest;
try {
manifest = validateManifest('fake', { $schema: BAD_VALUE }, '/fake');
} catch (e) {
expect.fail();
}
expect(manifest).not.to.have.property('$schema');
const logs = request.get(`/_db/${db._name()}/_admin/log`, {json: true}).json;
expect(logs.text.filter(text => text.includes(BAD_VALUE))).to.be.empty;
});
});