@aws-cdk/cloud-assembly-schema 39.1.39 → 39.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/manifest.js +1 -1
- package/node_modules/jsonschema/README.md +0 -30
- package/node_modules/jsonschema/lib/helpers.js +6 -22
- package/node_modules/jsonschema/lib/index.d.ts +0 -11
- package/node_modules/jsonschema/lib/scan.js +3 -3
- package/node_modules/jsonschema/lib/validator.js +5 -3
- package/node_modules/jsonschema/package.json +2 -2
- package/package.json +2 -2
package/.jsii
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://aws.amazon.com"
|
|
9
9
|
},
|
|
10
10
|
"bundled": {
|
|
11
|
-
"jsonschema": "
|
|
11
|
+
"jsonschema": "~1.4.1",
|
|
12
12
|
"semver": "^7.6.3"
|
|
13
13
|
},
|
|
14
14
|
"description": "Cloud Assembly Schema",
|
|
@@ -5511,6 +5511,6 @@
|
|
|
5511
5511
|
"symbolId": "lib/cloud-assembly/context-queries:VpcContextQuery"
|
|
5512
5512
|
}
|
|
5513
5513
|
},
|
|
5514
|
-
"version": "39.1.
|
|
5515
|
-
"fingerprint": "
|
|
5514
|
+
"version": "39.1.40",
|
|
5515
|
+
"fingerprint": "K0G+YC/8xEqg4+74LL01KtaFidF66m72bRjA7I3P9dw="
|
|
5516
5516
|
}
|
package/lib/manifest.js
CHANGED
|
@@ -249,7 +249,7 @@ class Manifest {
|
|
|
249
249
|
}
|
|
250
250
|
exports.Manifest = Manifest;
|
|
251
251
|
_a = JSII_RTTI_SYMBOL_1;
|
|
252
|
-
Manifest[_a] = { fqn: "@aws-cdk/cloud-assembly-schema.Manifest", version: "39.1.
|
|
252
|
+
Manifest[_a] = { fqn: "@aws-cdk/cloud-assembly-schema.Manifest", version: "39.1.40" };
|
|
253
253
|
function mapValues(xs, fn) {
|
|
254
254
|
if (!xs) {
|
|
255
255
|
return undefined;
|
|
@@ -80,8 +80,6 @@ var p = {
|
|
|
80
80
|
v.addSchema(addressSchema, '/SimpleAddress');
|
|
81
81
|
console.log(v.validate(p, schema));
|
|
82
82
|
```
|
|
83
|
-
Returned ValidatorResult object, will show this example is NOT valid since: `"votes": "lots"` is not an integer.
|
|
84
|
-
|
|
85
83
|
### Example for Array schema
|
|
86
84
|
|
|
87
85
|
```json
|
|
@@ -270,34 +268,6 @@ function importNextSchema(){
|
|
|
270
268
|
}
|
|
271
269
|
importNextSchema();
|
|
272
270
|
```
|
|
273
|
-
### Disallowing unknown attributes
|
|
274
|
-
|
|
275
|
-
Sometimes you may want to disallow unknown attributes passed in the body of the request, in order to disallow those unknown attributes before the validation of the body, you need to set additionalProperties to false.
|
|
276
|
-
|
|
277
|
-
```javascript
|
|
278
|
-
{
|
|
279
|
-
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
280
|
-
"title": "Accounting Resource - Add Item",
|
|
281
|
-
"type": "object",
|
|
282
|
-
"additionalProperties": false,
|
|
283
|
-
"properties": {
|
|
284
|
-
"itemNumber": {
|
|
285
|
-
"type":"string"
|
|
286
|
-
},
|
|
287
|
-
"title": {
|
|
288
|
-
"type":"string"
|
|
289
|
-
},
|
|
290
|
-
"description": {
|
|
291
|
-
"type":"string"
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
"required": [
|
|
295
|
-
"itemNumber",
|
|
296
|
-
"title",
|
|
297
|
-
"description"
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
```
|
|
301
271
|
|
|
302
272
|
### Default base URI
|
|
303
273
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var uri = require('url');
|
|
4
|
+
|
|
3
5
|
var ValidationError = exports.ValidationError = function ValidationError (message, instance, schema, path, name, argument) {
|
|
4
6
|
if(Array.isArray(path)){
|
|
5
7
|
this.path = path;
|
|
@@ -82,7 +84,7 @@ Object.defineProperty(ValidatorResult.prototype, "valid", { get: function() {
|
|
|
82
84
|
|
|
83
85
|
module.exports.ValidatorResultError = ValidatorResultError;
|
|
84
86
|
function ValidatorResultError(result) {
|
|
85
|
-
if(
|
|
87
|
+
if(Error.captureStackTrace){
|
|
86
88
|
Error.captureStackTrace(this, ValidatorResultError);
|
|
87
89
|
}
|
|
88
90
|
this.instance = result.instance;
|
|
@@ -103,9 +105,7 @@ var SchemaError = exports.SchemaError = function SchemaError (msg, schema) {
|
|
|
103
105
|
this.message = msg;
|
|
104
106
|
this.schema = schema;
|
|
105
107
|
Error.call(this, msg);
|
|
106
|
-
|
|
107
|
-
Error.captureStackTrace(this, SchemaError);
|
|
108
|
-
}
|
|
108
|
+
Error.captureStackTrace(this, SchemaError);
|
|
109
109
|
};
|
|
110
110
|
SchemaError.prototype = Object.create(Error.prototype,
|
|
111
111
|
{
|
|
@@ -129,13 +129,13 @@ var SchemaContext = exports.SchemaContext = function SchemaContext (schema, opti
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
SchemaContext.prototype.resolve = function resolve (target) {
|
|
132
|
-
return (
|
|
132
|
+
return uri.resolve(this.base, target);
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
SchemaContext.prototype.makeChild = function makeChild(schema, propertyName){
|
|
136
136
|
var path = (propertyName===undefined) ? this.path : this.path.concat([propertyName]);
|
|
137
137
|
var id = schema.$id || schema.id;
|
|
138
|
-
|
|
138
|
+
var base = uri.resolve(this.base, id||'');
|
|
139
139
|
var ctx = new SchemaContext(schema, this.options, path, base, Object.create(this.schemas));
|
|
140
140
|
if(id && !ctx.schemas[base]){
|
|
141
141
|
ctx.schemas[base] = schema;
|
|
@@ -388,19 +388,3 @@ exports.isSchema = function isSchema(val){
|
|
|
388
388
|
return (typeof val === 'object' && val) || (typeof val === 'boolean');
|
|
389
389
|
};
|
|
390
390
|
|
|
391
|
-
/**
|
|
392
|
-
* Resolve target URL from a base and relative URL.
|
|
393
|
-
* Similar to Node's URL Lib's legacy resolve function.
|
|
394
|
-
* Code from example in deprecation note in said library.
|
|
395
|
-
* @param string
|
|
396
|
-
* @param string
|
|
397
|
-
* @returns {string}
|
|
398
|
-
*/
|
|
399
|
-
var resolveUrl = exports.resolveUrl = function resolveUrl(from, to) {
|
|
400
|
-
const resolvedUrl = new URL(to, new URL(from, 'resolve://'));
|
|
401
|
-
if (resolvedUrl.protocol === 'resolve:') {
|
|
402
|
-
const { pathname, search, hash } = resolvedUrl;
|
|
403
|
-
return pathname + search + hash;
|
|
404
|
-
}
|
|
405
|
-
return resolvedUrl.toString();
|
|
406
|
-
}
|
|
@@ -27,13 +27,6 @@ export declare class ValidatorResult {
|
|
|
27
27
|
toString(): string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export declare class ValidatorResultError extends Error {
|
|
31
|
-
instance: any;
|
|
32
|
-
schema: Schema;
|
|
33
|
-
options: Options;
|
|
34
|
-
errors: ValidationError;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
30
|
export declare class ValidationError {
|
|
38
31
|
constructor(message?: string, instance?: any, schema?: Schema, propertyPath?: any, name?: string, argument?: any);
|
|
39
32
|
path: (string|number)[];
|
|
@@ -72,14 +65,12 @@ export interface Schema {
|
|
|
72
65
|
pattern?: string | RegExp
|
|
73
66
|
additionalItems?: boolean | Schema
|
|
74
67
|
items?: Schema | Schema[]
|
|
75
|
-
contains?: Schema
|
|
76
68
|
maxItems?: number
|
|
77
69
|
minItems?: number
|
|
78
70
|
uniqueItems?: boolean
|
|
79
71
|
maxProperties?: number
|
|
80
72
|
minProperties?: number
|
|
81
73
|
required?: string[] | boolean
|
|
82
|
-
propertyNames?: boolean | Schema
|
|
83
74
|
additionalProperties?: boolean | Schema
|
|
84
75
|
definitions?: {
|
|
85
76
|
[name: string]: Schema
|
|
@@ -104,8 +95,6 @@ export interface Schema {
|
|
|
104
95
|
if?: Schema
|
|
105
96
|
then?: Schema
|
|
106
97
|
else?: Schema
|
|
107
|
-
default?: any
|
|
108
|
-
examples?: any[]
|
|
109
98
|
}
|
|
110
99
|
|
|
111
100
|
export interface Options {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var urilib = require('url');
|
|
3
4
|
var helpers = require('./helpers');
|
|
4
5
|
|
|
5
6
|
module.exports.SchemaScanResult = SchemaScanResult;
|
|
@@ -19,13 +20,12 @@ module.exports.scan = function scan(base, schema){
|
|
|
19
20
|
if(!schema || typeof schema!='object') return;
|
|
20
21
|
// Mark all referenced schemas so we can tell later which schemas are referred to, but never defined
|
|
21
22
|
if(schema.$ref){
|
|
22
|
-
|
|
23
|
+
var resolvedUri = urilib.resolve(baseuri, schema.$ref);
|
|
23
24
|
ref[resolvedUri] = ref[resolvedUri] ? ref[resolvedUri]+1 : 0;
|
|
24
25
|
return;
|
|
25
26
|
}
|
|
26
27
|
var id = schema.$id || schema.id;
|
|
27
|
-
|
|
28
|
-
var ourBase = id ? resolvedBase : baseuri;
|
|
28
|
+
var ourBase = id ? urilib.resolve(baseuri, id) : baseuri;
|
|
29
29
|
if (ourBase) {
|
|
30
30
|
// If there's no fragment, append an empty one
|
|
31
31
|
if(ourBase.indexOf('#')<0) ourBase += '#';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var urilib = require('url');
|
|
4
|
+
|
|
3
5
|
var attribute = require('./attribute');
|
|
4
6
|
var helpers = require('./helpers');
|
|
5
7
|
var scanSchema = require('./scan').scan;
|
|
@@ -113,7 +115,7 @@ Validator.prototype.validate = function validate (instance, schema, options, ctx
|
|
|
113
115
|
// This section indexes subschemas in the provided schema, so they don't need to be added with Validator#addSchema
|
|
114
116
|
// This will work so long as the function at uri.resolve() will resolve a relative URI to a relative URI
|
|
115
117
|
var id = schema.$id || schema.id;
|
|
116
|
-
|
|
118
|
+
var base = urilib.resolve(options.base||anonymousBase, id||'');
|
|
117
119
|
if(!ctx){
|
|
118
120
|
ctx = new SchemaContext(schema, options, [], base, Object.create(this.schemas));
|
|
119
121
|
if (!ctx.schemas[base]) {
|
|
@@ -260,8 +262,8 @@ Validator.prototype.resolve = function resolve (schema, switchSchema, ctx) {
|
|
|
260
262
|
return {subschema: ctx.schemas[switchSchema], switchSchema: switchSchema};
|
|
261
263
|
}
|
|
262
264
|
// Else try walking the property pointer
|
|
263
|
-
|
|
264
|
-
|
|
265
|
+
var parsed = urilib.parse(switchSchema);
|
|
266
|
+
var fragment = parsed && parsed.hash;
|
|
265
267
|
var document = fragment && fragment.length && switchSchema.substr(0, switchSchema.length - fragment.length);
|
|
266
268
|
if (!document || !ctx.schemas[document]) {
|
|
267
269
|
throw new SchemaError("no such schema <" + switchSchema + ">", schema);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Tom de Grunt <tom@degrunt.nl>",
|
|
3
3
|
"name": "jsonschema",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"dependencies": {},
|
|
7
7
|
"contributors": [
|
|
@@ -39,4 +39,4 @@
|
|
|
39
39
|
"stryker": "stryker run",
|
|
40
40
|
"test": "./node_modules/.bin/mocha -R spec"
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"typescript-json-schema": "^0.65.1"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"jsonschema": "
|
|
69
|
+
"jsonschema": "~1.4.1",
|
|
70
70
|
"semver": "^7.6.3"
|
|
71
71
|
},
|
|
72
72
|
"bundledDependencies": [
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"main": "lib/index.js",
|
|
81
81
|
"license": "Apache-2.0",
|
|
82
82
|
"homepage": "https://github.com/cdklabs/cloud-assembly-schema",
|
|
83
|
-
"version": "39.1.
|
|
83
|
+
"version": "39.1.40",
|
|
84
84
|
"types": "lib/index.d.ts",
|
|
85
85
|
"stability": "stable",
|
|
86
86
|
"jsii": {
|