Change parent domain attribute to subdomainOf

Signed-off-by: Jano González <info@janogonzalez.com>
Signed-off-by: Dawn James <dawnj@spotify.com>
This commit is contained in:
Jano González
2024-04-05 16:38:46 +02:00
committed by Dawn James
parent 8d96b58adb
commit 645668a1b3
5 changed files with 16 additions and 15 deletions
@@ -11,4 +11,4 @@ metadata:
icon: dashboard
spec:
owner: team-a
domain: audio
subdomainOf: audio
@@ -5,3 +5,4 @@ metadata:
description: Everything related to audio playback
spec:
owner: user:frank.tiernan
subdomainOf: audio
@@ -31,7 +31,7 @@ describe('DomainV1alpha1Validator', () => {
},
spec: {
owner: 'me',
domain: 'parent',
subdomainOf: 'parent-domain',
},
};
});
@@ -70,18 +70,18 @@ describe('DomainV1alpha1Validator', () => {
await expect(validator.check(entity)).rejects.toThrow(/owner/);
});
it('accepts missing domain', async () => {
delete (entity as any).spec.domain;
it('accepts missing subdomainOf', async () => {
delete (entity as any).spec.subdomainOf;
await expect(validator.check(entity)).resolves.toBe(true);
});
it('rejects wrong domain', async () => {
(entity as any).spec.domain = 7;
await expect(validator.check(entity)).rejects.toThrow(/domain/);
it('rejects wrong subdomainOf', async () => {
(entity as any).spec.subdomainOf = 7;
await expect(validator.check(entity)).rejects.toThrow(/subdomainOf/);
});
it('rejects empty domain', async () => {
(entity as any).spec.domain = '';
await expect(validator.check(entity)).rejects.toThrow(/domain/);
it('rejects empty subdomainOf', async () => {
(entity as any).spec.subdomainOf = '';
await expect(validator.check(entity)).rejects.toThrow(/subdomainOf/);
});
});
@@ -32,7 +32,7 @@ export interface DomainEntityV1alpha1 extends Entity {
kind: 'Domain';
spec: {
owner: string;
domain?: string;
subdomainOf?: string;
};
}
@@ -12,7 +12,7 @@
},
"spec": {
"owner": "artist-relations-team",
"domain": "artists"
"subdomainOf": "audio"
}
}
],
@@ -40,10 +40,10 @@
"examples": ["artist-relations-team", "user:john.johnson"],
"minLength": 1
},
"domain": {
"subdomainOf": {
"type": "string",
"description": "An entity reference to the domain that the system belongs to.",
"examples": ["artists"],
"description": "An entity reference to another domain of which the domain is a part.",
"examples": ["audio"],
"minLength": 1
}
}