Add spec.type to Sytem model

Signed-off-by: Joe Van Alstyne <jvanalstyne@mdsol.com>
This commit is contained in:
Joe Van Alstyne
2024-06-10 18:54:32 +09:00
parent 4e392ebdc4
commit ccb514f24d
6 changed files with 23 additions and 1 deletions
@@ -8,3 +8,4 @@ metadata:
spec:
owner: team-a
domain: artists
type: service
@@ -6,3 +6,4 @@ metadata:
spec:
owner: team-c
domain: playback
type: feature-set
@@ -6,3 +6,4 @@ metadata:
spec:
owner: team-b
domain: playback
type: feature-set
@@ -32,6 +32,7 @@ describe('SystemV1alpha1Validator', () => {
spec: {
owner: 'me',
domain: 'domain',
type: 'system-type',
},
};
});
@@ -84,4 +85,14 @@ describe('SystemV1alpha1Validator', () => {
(entity as any).spec.domain = '';
await expect(validator.check(entity)).rejects.toThrow(/domain/);
});
it('accepts missing type', async () => {
delete (entity as any).spec.type;
await expect(validator.check(entity)).resolves.toBe(true);
});
it('rejects empty type', async () => {
(entity as any).spec.type = '';
await expect(validator.check(entity)).rejects.toThrow(/type/);
});
});
@@ -33,6 +33,7 @@ export interface SystemEntityV1alpha1 extends Entity {
spec: {
owner: string;
domain?: string;
type?: string;
};
}
@@ -12,7 +12,8 @@
},
"spec": {
"owner": "artist-relations-team",
"domain": "artists"
"domain": "artists",
"type": "service"
}
}
],
@@ -45,6 +46,12 @@
"description": "An entity reference to the domain that the system belongs to.",
"examples": ["artists"],
"minLength": 1
},
"type": {
"type": "string",
"description": "The type of system. There is currently no enforced set of values for this field, so it is left up to the adopting organization to choose a nomenclature that matches their catalog hierarchy.",
"examples": ["product", "service", "feature-set"],
"minLength": 1
}
}
}