klasik 1.0.10 โ 1.0.12
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/dist/k8s-client-generator.js +3 -0
- package/package.json +4 -2
- package/test-discriminated-output/.openapi-generator-ignore +23 -0
- package/test-discriminated-output/api/default-api.ts +142 -0
- package/test-discriminated-output/api.ts +19 -0
- package/test-discriminated-output/base.ts +86 -0
- package/test-discriminated-output/common.ts +151 -0
- package/test-discriminated-output/configuration.ts +152 -0
- package/test-discriminated-output/index.ts +18 -0
- package/test-discriminated-output/models/capability.js +80 -0
- package/test-discriminated-output/models/capability.ts +74 -0
- package/test-discriminated-output/models/helm-component.js +82 -0
- package/test-discriminated-output/models/helm-component.ts +83 -0
- package/test-discriminated-output/models/index.ts +4 -0
- package/test-discriminated-output/models/kustomize-component.js +70 -0
- package/test-discriminated-output/models/kustomize-component.ts +70 -0
- package/test-discriminated-output/models/manifest-component.js +58 -0
- package/test-discriminated-output/models/manifest-component.ts +57 -0
- package/test-runtime.js +72 -0
- package/test-runtime.ts +80 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
// May contain unused imports in some cases
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
import { Expose, Type } from 'class-transformer';
|
|
26
|
+
import { HelmComponent } from './helm-component.js';
|
|
27
|
+
import { KustomizeComponent } from './kustomize-component.js';
|
|
28
|
+
import { ManifestComponent } from './manifest-component.js';
|
|
29
|
+
var Capability = /** @class */ (function () {
|
|
30
|
+
function Capability() {
|
|
31
|
+
}
|
|
32
|
+
Capability.attributeTypeMap = [
|
|
33
|
+
{
|
|
34
|
+
"name": "name",
|
|
35
|
+
"baseName": "name",
|
|
36
|
+
"type": "string",
|
|
37
|
+
"format": "",
|
|
38
|
+
"description": "Capability name",
|
|
39
|
+
"vendorExtensions": {}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "description",
|
|
43
|
+
"baseName": "description",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"format": "",
|
|
46
|
+
"description": undefined,
|
|
47
|
+
"vendorExtensions": {}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "components",
|
|
51
|
+
"baseName": "components",
|
|
52
|
+
"type": "Array<HelmComponent | KustomizeComponent | ManifestComponent>",
|
|
53
|
+
"format": "",
|
|
54
|
+
"description": undefined,
|
|
55
|
+
"vendorExtensions": {},
|
|
56
|
+
"modelClasses": [HelmComponent, KustomizeComponent, ManifestComponent], "discriminatorProperty": "type"
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
__decorate([
|
|
60
|
+
Expose(),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], Capability.prototype, "name", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Expose(),
|
|
65
|
+
__metadata("design:type", String)
|
|
66
|
+
], Capability.prototype, "description", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Expose(),
|
|
69
|
+
Type(function () { return Object; }, {
|
|
70
|
+
discriminator: {
|
|
71
|
+
property: 'type',
|
|
72
|
+
subTypes: [{ value: HelmComponent, name: 'helm' }, { value: KustomizeComponent, name: 'kustomize' }, { value: ManifestComponent, name: 'manifest' }]
|
|
73
|
+
},
|
|
74
|
+
keepDiscriminatorProperty: true
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Array)
|
|
77
|
+
], Capability.prototype, "components", void 0);
|
|
78
|
+
return Capability;
|
|
79
|
+
}());
|
|
80
|
+
export { Capability };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// May contain unused imports in some cases
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
import { Expose, Type } from 'class-transformer';
|
|
19
|
+
import { HelmComponent } from './helm-component.js';
|
|
20
|
+
import { KustomizeComponent } from './kustomize-component.js';
|
|
21
|
+
import { ManifestComponent } from './manifest-component.js';
|
|
22
|
+
export class Capability {
|
|
23
|
+
/**
|
|
24
|
+
* Capability name
|
|
25
|
+
*/
|
|
26
|
+
@Expose()
|
|
27
|
+
'name': string;
|
|
28
|
+
/**
|
|
29
|
+
* description
|
|
30
|
+
*/
|
|
31
|
+
@Expose()
|
|
32
|
+
'description'?: string;
|
|
33
|
+
/**
|
|
34
|
+
* components
|
|
35
|
+
*/
|
|
36
|
+
@Expose()
|
|
37
|
+
@Type(() => Object, {
|
|
38
|
+
discriminator: {
|
|
39
|
+
property: 'type',
|
|
40
|
+
subTypes: [{ value: HelmComponent, name: 'helm' }, { value: KustomizeComponent, name: 'kustomize' }, { value: ManifestComponent, name: 'manifest' }]
|
|
41
|
+
},
|
|
42
|
+
keepDiscriminatorProperty: true
|
|
43
|
+
})
|
|
44
|
+
'components': Array<HelmComponent | KustomizeComponent | ManifestComponent>;
|
|
45
|
+
|
|
46
|
+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string, description?: string, vendorExtensions?: any, modelClass?: any}> = [
|
|
47
|
+
{
|
|
48
|
+
"name": "name",
|
|
49
|
+
"baseName": "name",
|
|
50
|
+
"type": "string",
|
|
51
|
+
"format": "",
|
|
52
|
+
"description": `Capability name`,
|
|
53
|
+
"vendorExtensions": {}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "description",
|
|
57
|
+
"baseName": "description",
|
|
58
|
+
"type": "string",
|
|
59
|
+
"format": "",
|
|
60
|
+
"description": undefined,
|
|
61
|
+
"vendorExtensions": {}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "components",
|
|
65
|
+
"baseName": "components",
|
|
66
|
+
"type": "Array<HelmComponent | KustomizeComponent | ManifestComponent>",
|
|
67
|
+
"format": "",
|
|
68
|
+
"description": undefined,
|
|
69
|
+
"vendorExtensions": {},
|
|
70
|
+
"modelClasses": [HelmComponent, KustomizeComponent, ManifestComponent], "discriminatorProperty": "type"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
import { Expose } from 'class-transformer';
|
|
24
|
+
var HelmComponent = /** @class */ (function () {
|
|
25
|
+
function HelmComponent() {
|
|
26
|
+
}
|
|
27
|
+
HelmComponent.attributeTypeMap = [
|
|
28
|
+
{
|
|
29
|
+
"name": "type",
|
|
30
|
+
"baseName": "type",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "",
|
|
33
|
+
"description": undefined,
|
|
34
|
+
"vendorExtensions": {}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "chartName",
|
|
38
|
+
"baseName": "chartName",
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "",
|
|
41
|
+
"description": "Helm chart name",
|
|
42
|
+
"vendorExtensions": {}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "version",
|
|
46
|
+
"baseName": "version",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "",
|
|
49
|
+
"description": "Chart version",
|
|
50
|
+
"vendorExtensions": {}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "values",
|
|
54
|
+
"baseName": "values",
|
|
55
|
+
"type": "object",
|
|
56
|
+
"format": "",
|
|
57
|
+
"description": "Helm values",
|
|
58
|
+
"vendorExtensions": {}
|
|
59
|
+
}
|
|
60
|
+
];
|
|
61
|
+
__decorate([
|
|
62
|
+
Expose(),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], HelmComponent.prototype, "type", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
Expose(),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], HelmComponent.prototype, "chartName", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
Expose(),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], HelmComponent.prototype, "version", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
Expose(),
|
|
75
|
+
__metadata("design:type", Object)
|
|
76
|
+
], HelmComponent.prototype, "values", void 0);
|
|
77
|
+
return HelmComponent;
|
|
78
|
+
}());
|
|
79
|
+
export { HelmComponent };
|
|
80
|
+
export var HelmComponentTypeEnum = {
|
|
81
|
+
Helm: 'helm'
|
|
82
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import { Expose, Type } from 'class-transformer';
|
|
19
|
+
export class HelmComponent {
|
|
20
|
+
/**
|
|
21
|
+
* type
|
|
22
|
+
*/
|
|
23
|
+
@Expose()
|
|
24
|
+
'type': HelmComponentTypeEnum;
|
|
25
|
+
/**
|
|
26
|
+
* Helm chart name
|
|
27
|
+
*/
|
|
28
|
+
@Expose()
|
|
29
|
+
'chartName': string;
|
|
30
|
+
/**
|
|
31
|
+
* Chart version
|
|
32
|
+
*/
|
|
33
|
+
@Expose()
|
|
34
|
+
'version'?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Helm values
|
|
37
|
+
*/
|
|
38
|
+
@Expose()
|
|
39
|
+
'values'?: object;
|
|
40
|
+
|
|
41
|
+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string, description?: string, vendorExtensions?: any, modelClass?: any}> = [
|
|
42
|
+
{
|
|
43
|
+
"name": "type",
|
|
44
|
+
"baseName": "type",
|
|
45
|
+
"type": "string",
|
|
46
|
+
"format": "",
|
|
47
|
+
"description": undefined,
|
|
48
|
+
"vendorExtensions": {}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "chartName",
|
|
52
|
+
"baseName": "chartName",
|
|
53
|
+
"type": "string",
|
|
54
|
+
"format": "",
|
|
55
|
+
"description": `Helm chart name`,
|
|
56
|
+
"vendorExtensions": {}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "version",
|
|
60
|
+
"baseName": "version",
|
|
61
|
+
"type": "string",
|
|
62
|
+
"format": "",
|
|
63
|
+
"description": `Chart version`,
|
|
64
|
+
"vendorExtensions": {}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "values",
|
|
68
|
+
"baseName": "values",
|
|
69
|
+
"type": "object",
|
|
70
|
+
"format": "",
|
|
71
|
+
"description": `Helm values`,
|
|
72
|
+
"vendorExtensions": {}
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const HelmComponentTypeEnum = {
|
|
78
|
+
Helm: 'helm'
|
|
79
|
+
} as const;
|
|
80
|
+
|
|
81
|
+
export type HelmComponentTypeEnum = typeof HelmComponentTypeEnum[keyof typeof HelmComponentTypeEnum];
|
|
82
|
+
|
|
83
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
import { Expose } from 'class-transformer';
|
|
24
|
+
var KustomizeComponent = /** @class */ (function () {
|
|
25
|
+
function KustomizeComponent() {
|
|
26
|
+
}
|
|
27
|
+
KustomizeComponent.attributeTypeMap = [
|
|
28
|
+
{
|
|
29
|
+
"name": "type",
|
|
30
|
+
"baseName": "type",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "",
|
|
33
|
+
"description": undefined,
|
|
34
|
+
"vendorExtensions": {}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "path",
|
|
38
|
+
"baseName": "path",
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "",
|
|
41
|
+
"description": "Path to kustomization",
|
|
42
|
+
"vendorExtensions": {}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "namespace",
|
|
46
|
+
"baseName": "namespace",
|
|
47
|
+
"type": "string",
|
|
48
|
+
"format": "",
|
|
49
|
+
"description": "Target namespace",
|
|
50
|
+
"vendorExtensions": {}
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
__decorate([
|
|
54
|
+
Expose(),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], KustomizeComponent.prototype, "type", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
Expose(),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], KustomizeComponent.prototype, "path", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
Expose(),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], KustomizeComponent.prototype, "namespace", void 0);
|
|
65
|
+
return KustomizeComponent;
|
|
66
|
+
}());
|
|
67
|
+
export { KustomizeComponent };
|
|
68
|
+
export var KustomizeComponentTypeEnum = {
|
|
69
|
+
Kustomize: 'kustomize'
|
|
70
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import { Expose, Type } from 'class-transformer';
|
|
19
|
+
export class KustomizeComponent {
|
|
20
|
+
/**
|
|
21
|
+
* type
|
|
22
|
+
*/
|
|
23
|
+
@Expose()
|
|
24
|
+
'type': KustomizeComponentTypeEnum;
|
|
25
|
+
/**
|
|
26
|
+
* Path to kustomization
|
|
27
|
+
*/
|
|
28
|
+
@Expose()
|
|
29
|
+
'path': string;
|
|
30
|
+
/**
|
|
31
|
+
* Target namespace
|
|
32
|
+
*/
|
|
33
|
+
@Expose()
|
|
34
|
+
'namespace'?: string;
|
|
35
|
+
|
|
36
|
+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string, description?: string, vendorExtensions?: any, modelClass?: any}> = [
|
|
37
|
+
{
|
|
38
|
+
"name": "type",
|
|
39
|
+
"baseName": "type",
|
|
40
|
+
"type": "string",
|
|
41
|
+
"format": "",
|
|
42
|
+
"description": undefined,
|
|
43
|
+
"vendorExtensions": {}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "path",
|
|
47
|
+
"baseName": "path",
|
|
48
|
+
"type": "string",
|
|
49
|
+
"format": "",
|
|
50
|
+
"description": `Path to kustomization`,
|
|
51
|
+
"vendorExtensions": {}
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "namespace",
|
|
55
|
+
"baseName": "namespace",
|
|
56
|
+
"type": "string",
|
|
57
|
+
"format": "",
|
|
58
|
+
"description": `Target namespace`,
|
|
59
|
+
"vendorExtensions": {}
|
|
60
|
+
}
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const KustomizeComponentTypeEnum = {
|
|
65
|
+
Kustomize: 'kustomize'
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
export type KustomizeComponentTypeEnum = typeof KustomizeComponentTypeEnum[keyof typeof KustomizeComponentTypeEnum];
|
|
69
|
+
|
|
70
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
17
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
18
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
|
+
};
|
|
20
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
21
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
|
+
};
|
|
23
|
+
import { Expose } from 'class-transformer';
|
|
24
|
+
var ManifestComponent = /** @class */ (function () {
|
|
25
|
+
function ManifestComponent() {
|
|
26
|
+
}
|
|
27
|
+
ManifestComponent.attributeTypeMap = [
|
|
28
|
+
{
|
|
29
|
+
"name": "type",
|
|
30
|
+
"baseName": "type",
|
|
31
|
+
"type": "string",
|
|
32
|
+
"format": "",
|
|
33
|
+
"description": undefined,
|
|
34
|
+
"vendorExtensions": {}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "manifests",
|
|
38
|
+
"baseName": "manifests",
|
|
39
|
+
"type": "Array<string>",
|
|
40
|
+
"format": "",
|
|
41
|
+
"description": "Raw Kubernetes manifests",
|
|
42
|
+
"vendorExtensions": {}
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
__decorate([
|
|
46
|
+
Expose(),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], ManifestComponent.prototype, "type", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
Expose(),
|
|
51
|
+
__metadata("design:type", Array)
|
|
52
|
+
], ManifestComponent.prototype, "manifests", void 0);
|
|
53
|
+
return ManifestComponent;
|
|
54
|
+
}());
|
|
55
|
+
export { ManifestComponent };
|
|
56
|
+
export var ManifestComponentTypeEnum = {
|
|
57
|
+
Manifest: 'manifest'
|
|
58
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Test API with Discriminated Unions
|
|
5
|
+
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 1.0.0
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import { Expose, Type } from 'class-transformer';
|
|
19
|
+
export class ManifestComponent {
|
|
20
|
+
/**
|
|
21
|
+
* type
|
|
22
|
+
*/
|
|
23
|
+
@Expose()
|
|
24
|
+
'type': ManifestComponentTypeEnum;
|
|
25
|
+
/**
|
|
26
|
+
* Raw Kubernetes manifests
|
|
27
|
+
*/
|
|
28
|
+
@Expose()
|
|
29
|
+
'manifests': Array<string>;
|
|
30
|
+
|
|
31
|
+
static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string, description?: string, vendorExtensions?: any, modelClass?: any}> = [
|
|
32
|
+
{
|
|
33
|
+
"name": "type",
|
|
34
|
+
"baseName": "type",
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "",
|
|
37
|
+
"description": undefined,
|
|
38
|
+
"vendorExtensions": {}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "manifests",
|
|
42
|
+
"baseName": "manifests",
|
|
43
|
+
"type": "Array<string>",
|
|
44
|
+
"format": "",
|
|
45
|
+
"description": `Raw Kubernetes manifests`,
|
|
46
|
+
"vendorExtensions": {}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const ManifestComponentTypeEnum = {
|
|
52
|
+
Manifest: 'manifest'
|
|
53
|
+
} as const;
|
|
54
|
+
|
|
55
|
+
export type ManifestComponentTypeEnum = typeof ManifestComponentTypeEnum[keyof typeof ManifestComponentTypeEnum];
|
|
56
|
+
|
|
57
|
+
|
package/test-runtime.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var _a, _b, _c;
|
|
2
|
+
import 'reflect-metadata';
|
|
3
|
+
import { plainToInstance } from 'class-transformer';
|
|
4
|
+
import { Capability } from './test-discriminated-output/models/capability.js';
|
|
5
|
+
import { HelmComponent } from './test-discriminated-output/models/helm-component.js';
|
|
6
|
+
import { KustomizeComponent } from './test-discriminated-output/models/kustomize-component.js';
|
|
7
|
+
import { ManifestComponent } from './test-discriminated-output/models/manifest-component.js';
|
|
8
|
+
// Test data with discriminated union
|
|
9
|
+
var plainData = {
|
|
10
|
+
name: 'my-app',
|
|
11
|
+
description: 'Application deployment',
|
|
12
|
+
components: [
|
|
13
|
+
{
|
|
14
|
+
type: 'helm',
|
|
15
|
+
chartName: 'nginx',
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
values: { replicas: 3 }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'kustomize',
|
|
21
|
+
path: './overlays/production',
|
|
22
|
+
namespace: 'prod'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
type: 'manifest',
|
|
26
|
+
manifests: [
|
|
27
|
+
'apiVersion: v1\nkind: ConfigMap',
|
|
28
|
+
'apiVersion: v1\nkind: Service'
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
console.log('๐งช Testing Discriminated Union Runtime Transformation\n');
|
|
34
|
+
// Transform using plainToInstance
|
|
35
|
+
var capability = plainToInstance(Capability, plainData);
|
|
36
|
+
// Verify instance types
|
|
37
|
+
console.log('โ
Verification Results:');
|
|
38
|
+
console.log(' capability instanceof Capability:', capability instanceof Capability);
|
|
39
|
+
console.log(' capability.name:', capability.name);
|
|
40
|
+
console.log(' capability.components.length:', capability.components.length);
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log('โ
Component Type Verification:');
|
|
43
|
+
console.log(' components[0] instanceof HelmComponent:', capability.components[0] instanceof HelmComponent);
|
|
44
|
+
console.log(' components[1] instanceof KustomizeComponent:', capability.components[1] instanceof KustomizeComponent);
|
|
45
|
+
console.log(' components[2] instanceof ManifestComponent:', capability.components[2] instanceof ManifestComponent);
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log('โ
Property Access:');
|
|
48
|
+
console.log(' HelmComponent.chartName:', capability.components[0].chartName);
|
|
49
|
+
console.log(' KustomizeComponent.path:', capability.components[1].path);
|
|
50
|
+
console.log(' ManifestComponent.manifests.length:', (_a = capability.components[2].manifests) === null || _a === void 0 ? void 0 : _a.length);
|
|
51
|
+
console.log('');
|
|
52
|
+
console.log('โ
attributeTypeMap Check:');
|
|
53
|
+
var componentsMetadata = Capability.attributeTypeMap.find(function (m) { return m.name === 'components'; });
|
|
54
|
+
console.log(' type:', componentsMetadata === null || componentsMetadata === void 0 ? void 0 : componentsMetadata.type);
|
|
55
|
+
console.log(' modelClasses:', (_b = componentsMetadata === null || componentsMetadata === void 0 ? void 0 : componentsMetadata.modelClasses) === null || _b === void 0 ? void 0 : _b.map(function (c) { return c.name; }));
|
|
56
|
+
console.log(' discriminatorProperty:', componentsMetadata === null || componentsMetadata === void 0 ? void 0 : componentsMetadata.discriminatorProperty);
|
|
57
|
+
console.log('');
|
|
58
|
+
// Final verification
|
|
59
|
+
var allCorrect = capability instanceof Capability &&
|
|
60
|
+
capability.components[0] instanceof HelmComponent &&
|
|
61
|
+
capability.components[1] instanceof KustomizeComponent &&
|
|
62
|
+
capability.components[2] instanceof ManifestComponent &&
|
|
63
|
+
capability.components[0].chartName === 'nginx' &&
|
|
64
|
+
capability.components[1].path === './overlays/production' &&
|
|
65
|
+
((_c = capability.components[2].manifests) === null || _c === void 0 ? void 0 : _c.length) === 2;
|
|
66
|
+
if (allCorrect) {
|
|
67
|
+
console.log('๐ SUCCESS! All discriminated union transformations working correctly!');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
console.log('โ FAILED! Some transformations did not work as expected.');
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|