@zeit/schemas
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,2 +0,2 @@ | ||
const envSchema = require('./env'); | ||
const {EnvObject} = require('./env'); | ||
const staticSchema = require('./config-static'); | ||
@@ -18,3 +18,3 @@ | ||
}, | ||
'env': envSchema, | ||
'env': EnvObject, | ||
'build': { | ||
@@ -24,3 +24,3 @@ type: 'object', | ||
properties: { | ||
env: envSchema | ||
env: EnvObject | ||
} | ||
@@ -27,0 +27,0 @@ }, |
@@ -0,18 +1,62 @@ | ||
const maxEnvLength = 100; | ||
const reservedEnvKeys = [ | ||
'NOW', | ||
'NOW_REGION', | ||
'NOW_DC', | ||
'NOW_URL', | ||
// Questionable? | ||
'PATH', | ||
'HOME', | ||
'TEMP', | ||
// Legacy | ||
'NOW_PLAN', | ||
'AUTH_TOKEN', | ||
'DEPLOYMENT_ID', | ||
'REGISTRY_AUTH_TOKEN' | ||
]; | ||
const EnvKey = { | ||
type: 'string', | ||
pattern: '^[A-z0-9_]+$', | ||
minLength: 1, | ||
maxLength: 256, | ||
not: { | ||
'enum': reservedEnvKeys | ||
} | ||
}; | ||
const EnvKeys = { | ||
type: 'array', | ||
minItems: 0, | ||
maxItems: maxEnvLength, | ||
uniqueItems: true, | ||
items: EnvKey, | ||
additionalProperties: false | ||
}; | ||
const EnvValue = { | ||
type: 'string', | ||
minLength: 0, | ||
maxLength: 65536 | ||
}; | ||
// { 'FOO': 'BAR' } | ||
const EnvObject = { | ||
type: 'object', | ||
minProperties: 0, | ||
maxProperties: maxEnvLength, | ||
patternProperties: { | ||
'.+': EnvValue | ||
}, | ||
additionalProperties: false | ||
}; | ||
module.exports = { | ||
anyOf: [ | ||
{ | ||
type: 'object', | ||
patternProperties: { | ||
'.+': { | ||
type: 'string' | ||
} | ||
} | ||
}, | ||
{ | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
} | ||
} | ||
] | ||
EnvKey, | ||
EnvKeys, | ||
EnvValue, | ||
EnvObject | ||
}; |
{ | ||
"name": "@zeit/schemas", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "All schemas used for validation that are shared between our projects", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -80,3 +80,3 @@ /* eslint camelcase: 0 */ | ||
exports.test_valid_build_env_types = () => { | ||
let isValid = ajv.validate(deploymentConfigSchema, { | ||
const isValid = ajv.validate(deploymentConfigSchema, { | ||
build: { | ||
@@ -89,11 +89,2 @@ env: { | ||
assert.equal(isValid, true); | ||
isValid = ajv.validate(deploymentConfigSchema, { | ||
build: { | ||
env: [ | ||
'USER_SUPPLIED_ENV' | ||
] | ||
} | ||
}); | ||
assert.equal(isValid, true); | ||
}; | ||
@@ -100,0 +91,0 @@ |
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
69063
15
552