Add spec.type to Domain model

Signed-off-by: Joe Van Alstyne <jvanalstyne@mdsol.com>
This commit is contained in:
Joe Van Alstyne
2024-06-05 17:30:20 +09:00
parent f8036017f6
commit 40808de767
5 changed files with 22 additions and 1 deletions
@@ -13,3 +13,4 @@ metadata:
spec:
owner: team-a
subdomainOf: audio
type: product-group
@@ -6,3 +6,4 @@ metadata:
spec:
owner: user:frank.tiernan
subdomainOf: audio
type: product-group
@@ -32,6 +32,7 @@ describe('DomainV1alpha1Validator', () => {
spec: {
owner: 'me',
subdomainOf: 'parent-domain',
type: 'domain-type',
},
};
});
@@ -84,4 +85,14 @@ describe('DomainV1alpha1Validator', () => {
(entity as any).spec.subdomainOf = '';
await expect(validator.check(entity)).rejects.toThrow(/subdomainOf/);
});
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 DomainEntityV1alpha1 extends Entity {
spec: {
owner: string;
subdomainOf?: string;
type?: string;
};
}
@@ -12,7 +12,8 @@
},
"spec": {
"owner": "artist-relations-team",
"subdomainOf": "audio"
"subdomainOf": "audio",
"type": "product-group"
}
}
],
@@ -45,6 +46,12 @@
"description": "An entity reference to another domain of which the domain is a part.",
"examples": ["audio"],
"minLength": 1
},
"type": {
"type": "string",
"description": "The type of domain. 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-group", "bundle"],
"minLength": 1
}
}
}