cdk-common 2.0.367 → 2.0.369

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.
Files changed (79) hide show
  1. package/.jsii +3 -3
  2. package/lib/main.js +1 -1
  3. package/node_modules/@aws-cdk/assert/LICENSE +1 -1
  4. package/node_modules/@aws-cdk/assert/NOTICE +1 -1
  5. package/node_modules/@aws-cdk/assert/package.json +8 -8
  6. package/node_modules/@aws-cdk/cfnspec/build-tools/template/LICENSE +1 -1
  7. package/node_modules/@aws-cdk/cfnspec/build-tools/template/NOTICE +1 -1
  8. package/node_modules/@aws-cdk/cfnspec/package.json +3 -3
  9. package/node_modules/@aws-cdk/cloudformation-diff/LICENSE +1 -1
  10. package/node_modules/@aws-cdk/cloudformation-diff/NOTICE +1 -1
  11. package/node_modules/@aws-cdk/cloudformation-diff/package.json +4 -4
  12. package/node_modules/table/node_modules/ajv/README.md +5 -4
  13. package/node_modules/table/node_modules/ajv/dist/compile/codegen/code.d.ts +5 -5
  14. package/node_modules/table/node_modules/ajv/dist/compile/codegen/index.d.ts +2 -2
  15. package/node_modules/table/node_modules/ajv/dist/compile/codegen/scope.d.ts +5 -5
  16. package/node_modules/table/node_modules/ajv/dist/compile/index.d.ts +1 -1
  17. package/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js +18 -7
  18. package/node_modules/table/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
  19. package/node_modules/table/node_modules/ajv/dist/compile/jtd/types.d.ts +2 -2
  20. package/node_modules/table/node_modules/ajv/dist/compile/resolve.d.ts +1 -1
  21. package/node_modules/table/node_modules/ajv/dist/compile/rules.d.ts +2 -2
  22. package/node_modules/table/node_modules/ajv/dist/compile/util.d.ts +2 -2
  23. package/node_modules/table/node_modules/ajv/dist/compile/validate/dataType.d.ts +1 -1
  24. package/node_modules/table/node_modules/ajv/dist/compile/validate/index.js +11 -1
  25. package/node_modules/table/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
  26. package/node_modules/table/node_modules/ajv/dist/compile/validate/subschema.d.ts +1 -1
  27. package/node_modules/table/node_modules/ajv/dist/core.d.ts +3 -3
  28. package/node_modules/table/node_modules/ajv/dist/jtd.d.ts +1 -1
  29. package/node_modules/table/node_modules/ajv/dist/runtime/equal.d.ts +1 -1
  30. package/node_modules/table/node_modules/ajv/dist/runtime/re2.d.ts +1 -1
  31. package/node_modules/table/node_modules/ajv/dist/runtime/uri.d.ts +1 -1
  32. package/node_modules/table/node_modules/ajv/dist/types/index.d.ts +19 -19
  33. package/node_modules/table/node_modules/ajv/dist/types/json-schema.d.ts +14 -14
  34. package/node_modules/table/node_modules/ajv/dist/types/jtd-schema.d.ts +30 -25
  35. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts +1 -1
  36. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts +1 -1
  37. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts +1 -1
  38. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts +1 -1
  39. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts +2 -2
  40. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/if.d.ts +1 -1
  41. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/index.d.ts +1 -1
  42. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts +1 -1
  43. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/not.d.ts +1 -1
  44. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts +1 -1
  45. package/node_modules/table/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts +1 -1
  46. package/node_modules/table/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts +1 -1
  47. package/node_modules/table/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts +1 -1
  48. package/node_modules/table/node_modules/ajv/dist/vocabularies/errors.d.ts +1 -1
  49. package/node_modules/table/node_modules/ajv/dist/vocabularies/format/format.d.ts +1 -1
  50. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts +1 -1
  51. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts +1 -1
  52. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts +1 -1
  53. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/error.d.ts +1 -1
  54. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/index.d.ts +1 -1
  55. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts +3 -3
  56. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/properties.js +8 -5
  57. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/properties.js.map +1 -1
  58. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/type.d.ts +3 -3
  59. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/values.d.ts +1 -1
  60. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/values.js +10 -7
  61. package/node_modules/table/node_modules/ajv/dist/vocabularies/jtd/values.js.map +1 -1
  62. package/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts +1 -1
  63. package/node_modules/table/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts +1 -1
  64. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/const.d.ts +1 -1
  65. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts +1 -1
  66. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/enum.d.ts +1 -1
  67. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/index.d.ts +2 -2
  68. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts +3 -3
  69. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts +1 -1
  70. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts +1 -1
  71. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/required.d.ts +1 -1
  72. package/node_modules/table/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts +1 -1
  73. package/node_modules/table/node_modules/ajv/lib/compile/jtd/serialize.ts +20 -14
  74. package/node_modules/table/node_modules/ajv/lib/compile/validate/index.ts +10 -1
  75. package/node_modules/table/node_modules/ajv/lib/types/jtd-schema.ts +21 -11
  76. package/node_modules/table/node_modules/ajv/lib/vocabularies/jtd/properties.ts +13 -6
  77. package/node_modules/table/node_modules/ajv/lib/vocabularies/jtd/values.ts +10 -7
  78. package/node_modules/table/node_modules/ajv/package.json +5 -5
  79. package/package.json +3 -3
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
2
- export declare type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {
2
+ export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {
3
3
  limit: number;
4
4
  }, AnySchema>;
5
5
  declare const def: CodeKeywordDefinition;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types";
2
- export declare type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", {
2
+ export type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", {
3
3
  unevaluatedProperty: string;
4
4
  }, AnySchema>;
5
5
  declare const def: CodeKeywordDefinition;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type ConstError = ErrorObject<"const", {
2
+ export type ConstError = ErrorObject<"const", {
3
3
  allowedValue: any;
4
4
  }>;
5
5
  declare const def: CodeKeywordDefinition;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
2
  import { DependenciesErrorParams, PropertyDependencies } from "../applicator/dependencies";
3
- export declare type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>;
3
+ export type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>;
4
4
  declare const def: CodeKeywordDefinition;
5
5
  export default def;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type EnumError = ErrorObject<"enum", {
2
+ export type EnumError = ErrorObject<"enum", {
3
3
  allowedValues: any[];
4
4
  }, any[] | {
5
5
  $data: string;
@@ -8,9 +8,9 @@ import { ConstError } from "./const";
8
8
  import { EnumError } from "./enum";
9
9
  declare const validation: Vocabulary;
10
10
  export default validation;
11
- declare type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", {
11
+ type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", {
12
12
  limit: number;
13
13
  }, number | {
14
14
  $data: string;
15
15
  }>;
16
- export declare type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError;
16
+ export type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError;
@@ -1,7 +1,7 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- declare type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum";
3
- declare type Comparison = "<=" | ">=" | "<" | ">";
4
- export declare type LimitNumberError = ErrorObject<Kwd, {
2
+ type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum";
3
+ type Comparison = "<=" | ">=" | "<" | ">";
4
+ export type LimitNumberError = ErrorObject<Kwd, {
5
5
  limit: number;
6
6
  comparison: Comparison;
7
7
  }, number | {
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type MultipleOfError = ErrorObject<"multipleOf", {
2
+ export type MultipleOfError = ErrorObject<"multipleOf", {
3
3
  multipleOf: number;
4
4
  }, number | {
5
5
  $data: string;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type PatternError = ErrorObject<"pattern", {
2
+ export type PatternError = ErrorObject<"pattern", {
3
3
  pattern: string;
4
4
  }, string | {
5
5
  $data: string;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type RequiredError = ErrorObject<"required", {
2
+ export type RequiredError = ErrorObject<"required", {
3
3
  missingProperty: string;
4
4
  }, string[] | {
5
5
  $data: string;
@@ -1,5 +1,5 @@
1
1
  import type { CodeKeywordDefinition, ErrorObject } from "../../types";
2
- export declare type UniqueItemsError = ErrorObject<"uniqueItems", {
2
+ export type UniqueItemsError = ErrorObject<"uniqueItems", {
3
3
  i: number;
4
4
  j: number;
5
5
  }, boolean | {
@@ -117,7 +117,7 @@ function serializeValues(cxt: SerializeCxt): void {
117
117
  gen.add(N.json, str`}`)
118
118
  }
119
119
 
120
- function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first: Name): void {
120
+ function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first?: Name): void {
121
121
  const {gen, data} = cxt
122
122
  addComma(cxt, first)
123
123
  serializeString({...cxt, data: key})
@@ -156,20 +156,24 @@ function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): v
156
156
  const optProps = keys(optionalProperties)
157
157
  const allProps = allProperties(props.concat(optProps))
158
158
  let first = !discriminator
159
+ let firstProp: Name | undefined
160
+
159
161
  for (const key of props) {
162
+ if (first) first = false
163
+ else gen.add(N.json, str`,`)
160
164
  serializeProperty(key, properties[key], keyValue(key))
161
165
  }
166
+ if (first) firstProp = gen.let("first", true)
162
167
  for (const key of optProps) {
163
168
  const value = keyValue(key)
164
- gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () =>
169
+ gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => {
170
+ addComma(cxt, firstProp)
165
171
  serializeProperty(key, optionalProperties[key], value)
166
- )
172
+ })
167
173
  }
168
174
  if (schema.additionalProperties) {
169
175
  gen.forIn("key", data, (key) =>
170
- gen.if(isAdditional(key, allProps), () =>
171
- serializeKeyValue(cxt, key, {}, gen.let("first", first))
172
- )
176
+ gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, firstProp))
173
177
  )
174
178
  }
175
179
 
@@ -190,8 +194,6 @@ function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): v
190
194
  }
191
195
 
192
196
  function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void {
193
- if (first) first = false
194
- else gen.add(N.json, str`,`)
195
197
  gen.add(N.json, str`${JSON.stringify(key)}:`)
196
198
  serializeCode({...cxt, schema: propSchema, data: value})
197
199
  }
@@ -251,10 +253,14 @@ function serializeEmpty({gen, data}: SerializeCxt): void {
251
253
  gen.add(N.json, _`JSON.stringify(${data})`)
252
254
  }
253
255
 
254
- function addComma({gen}: SerializeCxt, first: Name): void {
255
- gen.if(
256
- first,
257
- () => gen.assign(first, false),
258
- () => gen.add(N.json, str`,`)
259
- )
256
+ function addComma({gen}: SerializeCxt, first?: Name): void {
257
+ if (first) {
258
+ gen.if(
259
+ first,
260
+ () => gen.assign(first, false),
261
+ () => gen.add(N.json, str`,`)
262
+ )
263
+ } else {
264
+ gen.add(N.json, str`,`)
265
+ }
260
266
  }
@@ -286,7 +286,7 @@ function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void {
286
286
  strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`)
287
287
  }
288
288
  })
289
- it.dataTypes = it.dataTypes.filter((t) => includesType(types, t))
289
+ narrowSchemaTypes(it, types)
290
290
  }
291
291
 
292
292
  function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void {
@@ -316,6 +316,15 @@ function includesType(ts: JSONType[], t: JSONType): boolean {
316
316
  return ts.includes(t) || (t === "integer" && ts.includes("number"))
317
317
  }
318
318
 
319
+ function narrowSchemaTypes(it: SchemaObjCxt, withTypes: JSONType[]): void {
320
+ const ts: JSONType[] = []
321
+ for (const t of it.dataTypes) {
322
+ if (includesType(withTypes, t)) ts.push(t)
323
+ else if (withTypes.includes("integer") && t === "number") ts.push("integer")
324
+ }
325
+ it.dataTypes = ts
326
+ }
327
+
319
328
  function strictTypesError(it: SchemaObjCxt, msg: string): void {
320
329
  const schemaPath = it.schemaEnv.baseId + it.errSchemaPath
321
330
  msg += ` at "${schemaPath}" (strictTypes)`
@@ -74,7 +74,7 @@ type EnumString<T> = [T] extends [never]
74
74
  : null
75
75
 
76
76
  /** true if type is a union of string literals */
77
- type IsEnum<T> = null extends EnumString<Exclude<T, null>> ? false : true
77
+ type IsEnum<T> = null extends EnumString<T> ? false : true
78
78
 
79
79
  /** true only if all types are array types (not tuples) */
80
80
  // NOTE relies on the fact that tuples don't have an index at 0.5, but arrays
@@ -88,13 +88,18 @@ type IsElements<T> = false extends IsUnion<T>
88
88
  : false
89
89
 
90
90
  /** true if the the type is a values type */
91
- type IsValues<T> = false extends IsUnion<Exclude<T, null>>
92
- ? TypeEquality<keyof Exclude<T, null>, string>
91
+ type IsValues<T> = false extends IsUnion<T> ? TypeEquality<keyof T, string> : false
92
+
93
+ /** true if type is a properties type and Union is false, or type is a discriminator type and Union is true */
94
+ type IsRecord<T, Union extends boolean> = Union extends IsUnion<T>
95
+ ? null extends EnumString<keyof T>
96
+ ? false
97
+ : true
93
98
  : false
94
99
 
95
- /** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */
96
- type IsRecord<T, Union extends boolean> = Union extends IsUnion<Exclude<T, null>>
97
- ? null extends EnumString<keyof Exclude<T, null>>
100
+ /** true if type represents an empty record */
101
+ type IsEmptyRecord<T> = [T] extends [Record<string, never>]
102
+ ? [T] extends [never]
98
103
  ? false
99
104
  : true
100
105
  : false
@@ -131,7 +136,7 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
131
136
  ? {type: "timestamp"}
132
137
  : // enums - only accepts union of string literals
133
138
  // TODO we can't actually check that everything in the union was specified
134
- true extends IsEnum<T>
139
+ true extends IsEnum<Exclude<T, null>>
135
140
  ? {enum: EnumString<Exclude<T, null>>[]}
136
141
  : // arrays - only accepts arrays, could be array of unions to be resolved later
137
142
  true extends IsElements<Exclude<T, null>>
@@ -140,15 +145,20 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
140
145
  elements: JTDSchemaType<E, D>
141
146
  }
142
147
  : never
148
+ : // empty properties
149
+ true extends IsEmptyRecord<Exclude<T, null>>
150
+ ?
151
+ | {properties: Record<string, never>; optionalProperties?: Record<string, never>}
152
+ | {optionalProperties: Record<string, never>}
143
153
  : // values
144
- true extends IsValues<T>
154
+ true extends IsValues<Exclude<T, null>>
145
155
  ? T extends Record<string, infer V>
146
156
  ? {
147
157
  values: JTDSchemaType<V, D>
148
158
  }
149
159
  : never
150
160
  : // properties
151
- true extends IsRecord<T, false>
161
+ true extends IsRecord<Exclude<T, null>, false>
152
162
  ? ([RequiredKeys<Exclude<T, null>>] extends [never]
153
163
  ? {
154
164
  properties?: Record<string, never>
@@ -168,7 +178,7 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
168
178
  additionalProperties?: boolean
169
179
  }
170
180
  : // discriminator
171
- true extends IsRecord<T, true>
181
+ true extends IsRecord<Exclude<T, null>, true>
172
182
  ? {
173
183
  [K in keyof Exclude<T, null>]-?: Exclude<T, null>[K] extends string
174
184
  ? {
@@ -176,7 +186,7 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
176
186
  mapping: {
177
187
  // TODO currently allows descriminator to be present in schema
178
188
  [M in Exclude<T, null>[K]]: JTDSchemaType<
179
- Omit<T extends {[C in K]: M} ? T : never, K>,
189
+ Omit<T extends Record<K, M> ? T : never, K>,
180
190
  D
181
191
  >
182
192
  }
@@ -138,9 +138,7 @@ export function validateProperties(cxt: KeywordCxt): void {
138
138
 
139
139
  function validateAdditional(): void {
140
140
  gen.forIn("key", data, (key: Name) => {
141
- const _allProps =
142
- it.jtdDiscriminator === undefined ? allProps : [it.jtdDiscriminator].concat(allProps)
143
- const addProp = isAdditional(key, _allProps, "properties")
141
+ const addProp = isAdditional(key, allProps, "properties", it.jtdDiscriminator)
144
142
  const addOptProp = isAdditional(key, allOptProps, "optionalProperties")
145
143
  const extra =
146
144
  addProp === true ? addOptProp : addOptProp === true ? addProp : and(addProp, addOptProp)
@@ -159,14 +157,23 @@ export function validateProperties(cxt: KeywordCxt): void {
159
157
  })
160
158
  }
161
159
 
162
- function isAdditional(key: Name, props: string[], keyword: string): Code | true {
160
+ function isAdditional(
161
+ key: Name,
162
+ props: string[],
163
+ keyword: string,
164
+ jtdDiscriminator?: string
165
+ ): Code | true {
163
166
  let additional: Code | boolean
164
167
  if (props.length > 8) {
165
168
  // TODO maybe an option instead of hard-coded 8?
166
169
  const propsSchema = schemaRefOrVal(it, parentSchema[keyword], keyword)
167
170
  additional = not(isOwnProperty(gen, propsSchema as Code, key))
168
- } else if (props.length) {
169
- additional = and(...props.map((p) => _`${key} !== ${p}`))
171
+ if (jtdDiscriminator !== undefined) {
172
+ additional = and(additional, _`${key} !== ${jtdDiscriminator}`)
173
+ }
174
+ } else if (props.length || jtdDiscriminator !== undefined) {
175
+ const ps = jtdDiscriminator === undefined ? props : [jtdDiscriminator].concat(props)
176
+ additional = and(...ps.map((p) => _`${key} !== ${p}`))
170
177
  } else {
171
178
  additional = true
172
179
  }
@@ -1,7 +1,7 @@
1
1
  import type {CodeKeywordDefinition, SchemaObject} from "../../types"
2
2
  import type {KeywordCxt} from "../../compile/validate"
3
3
  import {alwaysValidSchema, Type} from "../../compile/util"
4
- import {not, Name} from "../../compile/codegen"
4
+ import {not, or, Name} from "../../compile/codegen"
5
5
  import {checkMetadata} from "./metadata"
6
6
  import {checkNullableObject} from "./nullable"
7
7
  import {typeError, _JTDTypeError} from "./error"
@@ -15,13 +15,16 @@ const def: CodeKeywordDefinition = {
15
15
  code(cxt: KeywordCxt) {
16
16
  checkMetadata(cxt)
17
17
  const {gen, data, schema, it} = cxt
18
- if (alwaysValidSchema(it, schema)) return
19
18
  const [valid, cond] = checkNullableObject(cxt, data)
20
- gen.if(cond)
21
- gen.assign(valid, validateMap())
22
- gen.elseIf(not(valid))
23
- cxt.error()
24
- gen.endIf()
19
+ if (alwaysValidSchema(it, schema)) {
20
+ gen.if(not(or(cond, valid)), () => cxt.error())
21
+ } else {
22
+ gen.if(cond)
23
+ gen.assign(valid, validateMap())
24
+ gen.elseIf(not(valid))
25
+ cxt.error()
26
+ gen.endIf()
27
+ }
25
28
  cxt.ok(valid)
26
29
 
27
30
  function validateMap(): Name | boolean {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ajv",
3
- "version": "8.11.2",
3
+ "version": "8.12.0",
4
4
  "description": "Another JSON Schema Validator",
5
5
  "main": "dist/ajv.js",
6
6
  "types": "dist/ajv.d.ts",
@@ -65,12 +65,12 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@ajv-validator/config": "^0.3.0",
68
- "@rollup/plugin-commonjs": "^23.0.2",
69
- "@rollup/plugin-json": "^4.1.0",
68
+ "@rollup/plugin-commonjs": "^24.0.0",
69
+ "@rollup/plugin-json": "^6.0.0",
70
70
  "@rollup/plugin-node-resolve": "^15.0.1",
71
- "@rollup/plugin-typescript": "^8.2.1",
71
+ "@rollup/plugin-typescript": "^10.0.1",
72
72
  "@types/chai": "^4.2.12",
73
- "@types/mocha": "^9.0.0",
73
+ "@types/mocha": "^10.0.0",
74
74
  "@types/node": "^18.11.9",
75
75
  "@types/require-from-string": "^1.2.0",
76
76
  "@typescript-eslint/eslint-plugin": "^3.8.0",
package/package.json CHANGED
@@ -55,7 +55,7 @@
55
55
  "jsii-pacmak": "^1.72.0",
56
56
  "json-schema": "^0.4.0",
57
57
  "npm-check-updates": "^16",
58
- "projen": "0.65.78",
58
+ "projen": "0.65.80",
59
59
  "standard-version": "^9",
60
60
  "ts-jest": "^27",
61
61
  "typescript": "3.9.10"
@@ -65,7 +65,7 @@
65
65
  "constructs": "^10.0.5"
66
66
  },
67
67
  "dependencies": {
68
- "@aws-cdk/assert": "^2.58.1",
68
+ "@aws-cdk/assert": "^2.59.0",
69
69
  "case": "^1.6.3",
70
70
  "sync-request": "^6.1.0"
71
71
  },
@@ -83,7 +83,7 @@
83
83
  ],
84
84
  "main": "lib/index.js",
85
85
  "license": "Apache-2.0",
86
- "version": "2.0.367",
86
+ "version": "2.0.369",
87
87
  "jest": {
88
88
  "testMatch": [
89
89
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",