Added catalog-model support for dependsOn to Component and dependencyOf to Resource. Updated relevant relationship generator entity processors, and system diagram support.
Signed-off-by: Jonah Grimes <jonah.grimes@gmail.com>
This commit is contained in:
@@ -32,4 +32,6 @@ spec:
|
||||
type: service
|
||||
lifecycle: experimental
|
||||
owner: team-a
|
||||
dependsOn:
|
||||
- artists-db
|
||||
system: artist-engagement-portal
|
||||
|
||||
@@ -36,6 +36,7 @@ describe('ComponentV1alpha1Validator', () => {
|
||||
subcomponentOf: 'monolith',
|
||||
providesApis: ['api-0'],
|
||||
consumesApis: ['api-0'],
|
||||
dependsOn: ['resource-0'],
|
||||
system: 'system',
|
||||
},
|
||||
};
|
||||
@@ -160,6 +161,26 @@ describe('ComponentV1alpha1Validator', () => {
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('accepts missing dependsOn', async () => {
|
||||
delete (entity as any).spec.dependsOn;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('rejects empty dependsOn', async () => {
|
||||
(entity as any).spec.dependsOn = [''];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/dependsOn/);
|
||||
});
|
||||
|
||||
it('rejects undefined dependsOn', async () => {
|
||||
(entity as any).spec.dependsOn = [undefined];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/dependsOn/);
|
||||
});
|
||||
|
||||
it('accepts no dependsOn', async () => {
|
||||
(entity as any).spec.dependsOn = [];
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('accepts missing system', async () => {
|
||||
delete (entity as any).spec.system;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
|
||||
@@ -34,6 +34,7 @@ export interface ComponentEntityV1alpha1 extends Entity {
|
||||
subcomponentOf?: string;
|
||||
providesApis?: string[];
|
||||
consumesApis?: string[];
|
||||
dependsOn?: string[];
|
||||
system?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ describe('ResourceV1alpha1Validator', () => {
|
||||
spec: {
|
||||
type: 'database',
|
||||
owner: 'me',
|
||||
dependencyOf: ['component-0'],
|
||||
system: 'system',
|
||||
},
|
||||
};
|
||||
@@ -86,6 +87,26 @@ describe('ResourceV1alpha1Validator', () => {
|
||||
await expect(validator.check(entity)).rejects.toThrow(/owner/);
|
||||
});
|
||||
|
||||
it('accepts missing dependencyOf', async () => {
|
||||
delete (entity as any).spec.dependencyOf;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('rejects empty dependencyOf', async () => {
|
||||
(entity as any).spec.dependencyOf = [''];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/dependencyOf/);
|
||||
});
|
||||
|
||||
it('rejects undefined dependencyOf', async () => {
|
||||
(entity as any).spec.dependencyOf = [undefined];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/dependencyOf/);
|
||||
});
|
||||
|
||||
it('accepts no dependencyOf', async () => {
|
||||
(entity as any).spec.dependencyOf = [];
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('accepts missing system', async () => {
|
||||
delete (entity as any).spec.system;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface ResourceEntityV1alpha1 extends Entity {
|
||||
spec: {
|
||||
type: string;
|
||||
owner: string;
|
||||
dependencyOf?: string[];
|
||||
system?: string;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +84,14 @@
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"dependsOn": {
|
||||
"type": "array",
|
||||
"description": "An array of entity references to the resources that the component depends on.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,14 @@
|
||||
"examples": ["artist-relations-team", "user:john.johnson"],
|
||||
"minLength": 1
|
||||
},
|
||||
"dependencyOf": {
|
||||
"type": "array",
|
||||
"description": "An array of entity references to the components that the resource is a dependency of.",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
}
|
||||
},
|
||||
"system": {
|
||||
"type": "string",
|
||||
"description": "An entity reference to the system that the resource belongs to.",
|
||||
|
||||
Reference in New Issue
Block a user