feat(catalog): add field to the component entity to specify implemented apis per component

This commit is contained in:
Dominik Henneke
2020-07-24 09:06:09 +02:00
parent b5f8aa89b8
commit 7c9e84bd1d
4 changed files with 26 additions and 0 deletions
@@ -254,6 +254,8 @@ spec:
type: website
lifecycle: production
owner: artist-relations@example.com
implementsApis:
- artist-api
```
In addition to the [common envelope metadata](#common-to-all-kinds-the-metadata)
@@ -314,6 +316,14 @@ Apart from being a string, the software catalog leaves the format of this field
open to implementers to choose. Most commonly, it is set to the ID or email of a
group of people in an organizational structure.
### `spec.implementsApis` [optional]
Links APIs that are implemented by the component, e.g. `artist-api`. This field
is optional.
The software catalog expects a list of one or more strings that references the
names of other entities of the `kind` `API`.
## Kind: Template
Describes the following entity kind:
@@ -0,0 +1,13 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: petstore
description: Petstore
spec:
type: service
lifecycle: experimental
owner: pets@example.com
implementedApis:
- petstore
- streetlights
- hello-world
@@ -35,6 +35,7 @@ describe('ComponentV1alpha1Policy', () => {
type: 'service',
lifecycle: 'production',
owner: 'me',
implementsApis: ['api-0'],
},
};
policy = new ComponentEntityV1alpha1Policy();
@@ -28,6 +28,7 @@ export interface ComponentEntityV1alpha1 extends Entity {
type: string;
lifecycle: string;
owner: string;
implementsApis?: string[];
};
}
@@ -43,6 +44,7 @@ export class ComponentEntityV1alpha1Policy implements EntityPolicy {
type: yup.string().required().min(1),
lifecycle: yup.string().required().min(1),
owner: yup.string().required().min(1),
implementsApis: yup.array(yup.string()).notRequired(),
})
.required(),
});