diff --git a/docs/java.md b/docs/java.md
index 531d0c75de..da8b7ee7b0 100644
--- a/docs/java.md
+++ b/docs/java.md
@@ -91,7 +91,7 @@ Returns a string representation of this construct.
##### `addDependency`
```java
-public void addDependency(IConstruct dependencies)
+public void addDependency(IConstruct... dependencies)
```
Create a dependency between this ApiObject and other constructs.
@@ -100,7 +100,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* software.constructs.IConstruct
+- *Type:* software.constructs.IConstruct...
the dependencies to add.
@@ -109,7 +109,7 @@ the dependencies to add.
##### `addJsonPatch`
```java
-public void addJsonPatch(JsonPatch ops)
+public void addJsonPatch(JsonPatch... ops)
```
Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object.
@@ -124,7 +124,7 @@ kubePod.addJsonPatch(JsonPatch.replace("/spec/enableServiceLinks", true));
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* JsonPatch...
The JSON-Patch operations to apply.
@@ -658,7 +658,7 @@ Returns a string representation of this construct.
##### `addDependency`
```java
-public void addDependency(IConstruct dependencies)
+public void addDependency(IConstruct... dependencies)
```
Create a dependency between this Chart and other constructs.
@@ -667,7 +667,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* software.constructs.IConstruct
+- *Type:* software.constructs.IConstruct...
the dependencies to add.
@@ -2615,14 +2615,14 @@ The value.
##### `addFinalizers`
```java
-public void addFinalizers(java.lang.String finalizers)
+public void addFinalizers(java.lang.String... finalizers)
```
Add one or more finalizers.
###### `finalizers`Required
-- *Type:* java.lang.String
+- *Type:* java.lang.String...
the finalizers.
@@ -3468,7 +3468,7 @@ JsonPatch.add("/biscuits/1", Map.of("name", "Ginger Nut"));
```java
import org.cdk8s.JsonPatch;
-JsonPatch.apply(java.lang.Object document, JsonPatch ops)
+JsonPatch.apply(java.lang.Object document, JsonPatch... ops)
```
Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result.
@@ -3483,7 +3483,7 @@ The document to patch.
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* JsonPatch...
The operations to apply.
@@ -4374,7 +4374,7 @@ The set of objects.
```java
import org.cdk8s.Yaml;
-Yaml.stringify(java.lang.Object docs)
+Yaml.stringify(java.lang.Object... docs)
```
Stringify a document (or multiple documents) into YAML.
@@ -4384,7 +4384,7 @@ undefined.
###### `docs`Required
-- *Type:* java.lang.Object
+- *Type:* java.lang.Object...
A set of objects to convert to YAML.
diff --git a/docs/python.md b/docs/python.md
index 66e80146ee..ab3c0f219b 100644
--- a/docs/python.md
+++ b/docs/python.md
@@ -94,7 +94,7 @@ Returns a string representation of this construct.
```python
def add_dependency(
- dependencies: IConstruct
+ dependencies: *IConstruct
) -> None
```
@@ -104,7 +104,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* constructs.IConstruct
+- *Type:* *constructs.IConstruct
the dependencies to add.
@@ -114,7 +114,7 @@ the dependencies to add.
```python
def add_json_patch(
- ops: JsonPatch
+ ops: *JsonPatch
) -> None
```
@@ -130,7 +130,7 @@ kube_pod.add_json_patch(JsonPatch.replace("/spec/enableServiceLinks", True))
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* *JsonPatch
The JSON-Patch operations to apply.
@@ -677,7 +677,7 @@ Returns a string representation of this construct.
```python
def add_dependency(
- dependencies: IConstruct
+ dependencies: *IConstruct
) -> None
```
@@ -687,7 +687,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* constructs.IConstruct
+- *Type:* *constructs.IConstruct
the dependencies to add.
@@ -2658,7 +2658,7 @@ The value.
```python
def add_finalizers(
- finalizers: str
+ finalizers: *str
) -> None
```
@@ -2666,7 +2666,7 @@ Add one or more finalizers.
###### `finalizers`Required
-- *Type:* str
+- *Type:* *str
the finalizers.
@@ -3668,7 +3668,7 @@ import cdk8s
cdk8s.JsonPatch.apply(
document: typing.Any,
- ops: JsonPatch
+ ops: *JsonPatch
)
```
@@ -3684,7 +3684,7 @@ The document to patch.
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* *JsonPatch
The operations to apply.
@@ -4768,7 +4768,7 @@ The set of objects.
import cdk8s
cdk8s.Yaml.stringify(
- docs: typing.Any
+ docs: *typing.Any
)
```
@@ -4779,7 +4779,7 @@ undefined.
###### `docs`Required
-- *Type:* typing.Any
+- *Type:* *typing.Any
A set of objects to convert to YAML.
diff --git a/docs/typescript.md b/docs/typescript.md
index 36aad1f26e..3c434b2f5a 100644
--- a/docs/typescript.md
+++ b/docs/typescript.md
@@ -66,7 +66,7 @@ Returns a string representation of this construct.
##### `addDependency`
```typescript
-public addDependency(dependencies: IConstruct): void
+public addDependency(dependencies: ...IConstruct[]): void
```
Create a dependency between this ApiObject and other constructs.
@@ -75,7 +75,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* constructs.IConstruct
+- *Type:* ...constructs.IConstruct[]
the dependencies to add.
@@ -84,7 +84,7 @@ the dependencies to add.
##### `addJsonPatch`
```typescript
-public addJsonPatch(ops: JsonPatch): void
+public addJsonPatch(ops: ...JsonPatch[]): void
```
Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for this API object.
@@ -98,7 +98,7 @@ Applies a set of RFC-6902 JSON-Patch operations to the manifest synthesized for
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* ...JsonPatch[]
The JSON-Patch operations to apply.
@@ -539,7 +539,7 @@ Returns a string representation of this construct.
##### `addDependency`
```typescript
-public addDependency(dependencies: IConstruct): void
+public addDependency(dependencies: ...IConstruct[]): void
```
Create a dependency between this Chart and other constructs.
@@ -548,7 +548,7 @@ These can be other ApiObjects, Charts, or custom.
###### `dependencies`Required
-- *Type:* constructs.IConstruct
+- *Type:* ...constructs.IConstruct[]
the dependencies to add.
@@ -2190,14 +2190,14 @@ The value.
##### `addFinalizers`
```typescript
-public addFinalizers(finalizers: string): void
+public addFinalizers(finalizers: ...string[]): void
```
Add one or more finalizers.
###### `finalizers`Required
-- *Type:* string
+- *Type:* ...string[]
the finalizers.
@@ -2990,7 +2990,7 @@ JsonPatch.add('/biscuits/1', { "name": "Ginger Nut" })
```typescript
import { JsonPatch } from 'cdk8s'
-JsonPatch.apply(document: any, ops: JsonPatch)
+JsonPatch.apply(document: any, ops: ...JsonPatch[])
```
Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result.
@@ -3005,7 +3005,7 @@ The document to patch.
###### `ops`Required
-- *Type:* JsonPatch
+- *Type:* ...JsonPatch[]
The operations to apply.
@@ -3885,7 +3885,7 @@ The set of objects.
```typescript
import { Yaml } from 'cdk8s'
-Yaml.stringify(docs: any)
+Yaml.stringify(docs: ...any[])
```
Stringify a document (or multiple documents) into YAML.
@@ -3895,7 +3895,7 @@ undefined.
###### `docs`Required
-- *Type:* any
+- *Type:* ...any[]
A set of objects to convert to YAML.
diff --git a/package.json b/package.json
index 8be5d5f79d..a072106250 100644
--- a/package.json
+++ b/package.json
@@ -68,7 +68,7 @@
"json-schema-to-typescript": "^10.1.5",
"projen": "^0.87.2",
"ts-jest": "^27",
- "typescript": "~5.5.4"
+ "typescript": "~5.6.2"
},
"peerDependencies": {
"constructs": "^10"
diff --git a/src/metadata.ts b/src/metadata.ts
index eb22f305ef..674a59ecaa 100644
--- a/src/metadata.ts
+++ b/src/metadata.ts
@@ -166,8 +166,8 @@ export class ApiObjectMetadataDefinition {
constructor(options: ApiObjectMetadataDefinitionOptions) {
this.name = options.name;
- this.labels = { ...options.labels } ?? { };
- this.annotations = { ...options.annotations } ?? { };
+ this.labels = { ...(options.labels ?? {}) };
+ this.annotations = { ...(options.annotations ?? {}) };
this.namespace = options.namespace;
this.finalizers = options.finalizers ? [...options.finalizers] : [];
this.ownerReferences = options.ownerReferences ? [...options.ownerReferences] : [];
diff --git a/test/metadata.test.ts b/test/metadata.test.ts
index 084bb371ac..94b38255d7 100644
--- a/test/metadata.test.ts
+++ b/test/metadata.test.ts
@@ -1,8 +1,15 @@
-import { ApiObject, ApiObjectMetadataDefinition, Lazy, OwnerReference, Testing } from '../src';
+import {
+ ApiObject,
+ ApiObjectMetadataDefinition,
+ Lazy,
+ OwnerReference,
+ Testing,
+} from '../src';
test('Can add a label', () => {
-
- const meta = new ApiObjectMetadataDefinition({ apiObject: createApiObject() });
+ const meta = new ApiObjectMetadataDefinition({
+ apiObject: createApiObject(),
+ });
meta.addLabel('key', 'value');
@@ -11,12 +18,12 @@ test('Can add a label', () => {
expect(actual.labels).toEqual({
key: 'value',
});
-
});
test('Can add an annotation', () => {
-
- const meta = new ApiObjectMetadataDefinition({ apiObject: createApiObject() });
+ const meta = new ApiObjectMetadataDefinition({
+ apiObject: createApiObject(),
+ });
meta.addAnnotation('key', 'value');
@@ -25,24 +32,24 @@ test('Can add an annotation', () => {
expect(actual.annotations).toEqual({
key: 'value',
});
-
});
test('Can add a finalizer', () => {
-
- const meta = new ApiObjectMetadataDefinition({ apiObject: createApiObject() });
+ const meta = new ApiObjectMetadataDefinition({
+ apiObject: createApiObject(),
+ });
meta.addFinalizers('my-finalizer');
const actual = meta.toJson();
expect(actual.finalizers).toEqual(['my-finalizer']);
-
});
test('Can add an owner reference', () => {
-
- const meta = new ApiObjectMetadataDefinition({ apiObject: createApiObject() });
+ const meta = new ApiObjectMetadataDefinition({
+ apiObject: createApiObject(),
+ });
meta.addOwnerReference({
apiVersion: 'v1',
@@ -53,17 +60,17 @@ test('Can add an owner reference', () => {
const actual = meta.toJson();
- expect(actual.ownerReferences).toEqual([{
- apiVersion: 'v1',
- kind: 'Pod',
- name: 'mypod',
- uid: 'abcdef12-3456-7890-abcd-ef1234567890',
- }]);
-
+ expect(actual.ownerReferences).toEqual([
+ {
+ apiVersion: 'v1',
+ kind: 'Pod',
+ name: 'mypod',
+ uid: 'abcdef12-3456-7890-abcd-ef1234567890',
+ },
+ ]);
});
test('Instantiation properties are all respected', () => {
-
const meta = new ApiObjectMetadataDefinition({
apiObject: createApiObject(),
labels: { key: 'value' },
@@ -86,17 +93,19 @@ test('Instantiation properties are all respected', () => {
};
expect(actual).toStrictEqual(expected);
-
});
test('ensure Lazy properties are resolved', () => {
-
const meta = new ApiObjectMetadataDefinition({
apiObject: createApiObject(),
labels: { key: 'value' },
annotations: {
key: 'value',
- lazy: Lazy.any({ produce: () => { return { uiMeta: 'is good' }; } }),
+ lazy: Lazy.any({
+ produce: () => {
+ return { uiMeta: 'is good' };
+ },
+ }),
},
name: 'name',
namespace: 'namespace',
@@ -119,7 +128,6 @@ test('ensure Lazy properties are resolved', () => {
};
expect(actual).toStrictEqual(expected);
-
});
test('Can include arbirary key/value options', () => {
@@ -249,4 +257,4 @@ function createApiObject(): ApiObject {
apiVersion: 'v1',
kind: 'Service',
});
-}
\ No newline at end of file
+}
diff --git a/yarn.lock b/yarn.lock
index 0142db7a4f..044ee25cfc 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4301,9 +4301,9 @@ jsii-diff@^1.103.1:
yargs "^16.2.0"
jsii-docgen@^10.5.0:
- version "10.5.2"
- resolved "https://registry.yarnpkg.com/jsii-docgen/-/jsii-docgen-10.5.2.tgz#09ebc7525cc8c09ccd59a2a73ddbd2dbbeb7e75e"
- integrity sha512-1qDMCvd22f5WnQRYqfexvyA/60KLPdPl2YqY1P5kqzfU3ImyPRNKKe2/KZxGZb2h78SEkXyvdaJvIdDto2Z+IQ==
+ version "10.5.3"
+ resolved "https://registry.yarnpkg.com/jsii-docgen/-/jsii-docgen-10.5.3.tgz#f5bfa35f9737914cafc4f57752766831d685a6db"
+ integrity sha512-H6QAaaoRG5/AnnuQWZcl8RKO09ButL8VYCuabbMr2lZBb2q9j15jnBhiQljtNVw/TvFikNn4aJ12p3Dra8DKbw==
dependencies:
"@jsii/spec" "^1.103.0"
case "^1.6.3"
@@ -6292,11 +6292,16 @@ typescript@next, typescript@~5.2.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
-typescript@~5.5, typescript@~5.5.4:
+typescript@~5.5:
version "5.5.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
+typescript@~5.6.2:
+ version "5.6.2"
+ resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0"
+ integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==
+
uglify-js@^3.1.4:
version "3.19.3"
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.19.3.tgz#82315e9bbc6f2b25888858acd1fff8441035b77f"