@zeit/schemas
Advanced tools
Comparing version 1.7.0 to 2.0.0
@@ -20,3 +20,43 @@ module.exports = { | ||
'headers': { | ||
type: 'array' | ||
type: 'array', | ||
maxItems: 50, | ||
minItems: 1, | ||
uniqueItems: true, | ||
items: { | ||
type: 'object', | ||
required: ['source', 'headers'], | ||
properties: { | ||
source: { | ||
type: 'string', | ||
maxLength: 100, | ||
minLength: 1 | ||
}, | ||
headers: { | ||
type: 'array', | ||
maxItems: 50, | ||
minItems: 1, | ||
uniqueItems: true, | ||
items: { | ||
type: 'object', | ||
required: ['key', 'value'], | ||
properties: { | ||
key: { | ||
type: 'string', | ||
minLength: 1, | ||
maxLength: 32, | ||
pattern: "^[a-zA-Z0-9_!#$%&'*+.^`|~-]+$" | ||
}, | ||
value: { | ||
type: 'string', | ||
minLength: 1, | ||
maxLength: 2048, | ||
pattern: "^[a-zA-Z0-9_!#$%&'*+., =^`|~-]+$" | ||
} | ||
}, | ||
additionalProperties: false | ||
} | ||
} | ||
}, | ||
additionalProperties: false | ||
} | ||
}, | ||
@@ -23,0 +63,0 @@ 'directoryListing': { |
@@ -1,5 +0,4 @@ | ||
const {EnvKeys, EnvObject} = require('./env'); | ||
const {EnvKeys, EnvObject} = require('./config-env'); | ||
const staticSchema = require('./config-static'); | ||
module.exports = { | ||
@@ -6,0 +5,0 @@ type: 'object', |
{ | ||
"name": "@zeit/schemas", | ||
"version": "1.7.0", | ||
"version": "2.0.0", | ||
"description": "All schemas used for validation that are shared between our projects", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -7,3 +7,3 @@ /* eslint camelcase: 0 */ | ||
EnvObject | ||
} = require('../deployment/env'); | ||
} = require('../deployment/config-env'); | ||
@@ -10,0 +10,0 @@ const ajv = new AJV({allErrors: true}); |
@@ -154,2 +154,59 @@ /* eslint camelcase: 0 */ | ||
exports.test_valid_static_headers_object = () => { | ||
const isValid = ajv.validate(deploymentConfigSchema, { | ||
'static': { | ||
headers: [ | ||
{ | ||
source: '/_next/webpack/chunks/*', | ||
headers: [{ | ||
key: 'Cache-Control', | ||
value: 'adssds' | ||
}] | ||
}, | ||
{ | ||
source: '/_next/static/commons/**', | ||
headers: [{ | ||
key: 'Cache-Control', | ||
value: 'public, max-age=31536000, immutable' | ||
}] | ||
}, | ||
{ | ||
source: '/_next/*/page/**/*.js', | ||
headers: [{ | ||
key: 'Cache-Control', | ||
value: 'public, max-age=31536000, immutable' | ||
}] | ||
} | ||
] | ||
} | ||
}); | ||
assert.equal(isValid, true); | ||
}; | ||
exports.test_invalid_static_headers_object = () => { | ||
const isValid = ajv.validate(deploymentConfigSchema, { | ||
'static': { | ||
headers: [ | ||
{ | ||
source: '/_next/webpack/chunks/*', | ||
headers: [{ | ||
key: ':alternate-protocol', | ||
value: 'foo\x00bar' | ||
}] | ||
}, | ||
{ | ||
source: '/_next/static/commons/**', | ||
headers: [{ | ||
key: 'Cache-Control', | ||
value: 'public, max-age=31536000, immutable' | ||
}] | ||
} | ||
] | ||
} | ||
}); | ||
assert.equal(isValid, false); | ||
}; | ||
exports.test_valid_static_object_trailing_slash = () => { | ||
@@ -156,0 +213,0 @@ const isValid = ajv.validate(deploymentConfigSchema, { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72536
725