Remove implementsApis
This was deprecated in #3449. This should not be merged sooner then Dec 14th, 2020!
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
'@backstage/catalog-model': minor
|
||||
'@backstage/plugin-catalog-backend': minor
|
||||
---
|
||||
|
||||
Remove `implementsApis` from `Component` entities. Deprecation happened in [#3449](https://github.com/backstage/backstage/pull/3449).
|
||||
Use `providesApis` instead.
|
||||
@@ -444,21 +444,6 @@ 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]
|
||||
|
||||
**NOTE**: This field was marked for deprecation on Nov 25nd, 2020. It will be
|
||||
removed entirely from the model on Dec 14th, 2020 in the repository and will not
|
||||
be present in released packages following the next release after that. Please
|
||||
update your code to not consume this field before the removal date.
|
||||
|
||||
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`.
|
||||
|
||||
This field has the same behavior as `spec.providesApis`.
|
||||
|
||||
### `spec.providesApis` [optional]
|
||||
|
||||
Links APIs that are provided by the component, e.g. `artist-api`. This field is
|
||||
|
||||
@@ -7,7 +7,7 @@ spec:
|
||||
type: service
|
||||
lifecycle: experimental
|
||||
owner: team-c
|
||||
implementsApis:
|
||||
providesApis:
|
||||
- petstore
|
||||
- streetlights
|
||||
- hello-world
|
||||
|
||||
@@ -33,7 +33,6 @@ describe('ComponentV1alpha1Validator', () => {
|
||||
type: 'service',
|
||||
lifecycle: 'production',
|
||||
owner: 'me',
|
||||
implementsApis: ['api-0'],
|
||||
providesApis: ['api-0'],
|
||||
consumesApis: ['api-0'],
|
||||
},
|
||||
@@ -104,26 +103,6 @@ describe('ComponentV1alpha1Validator', () => {
|
||||
await expect(validator.check(entity)).rejects.toThrow(/owner/);
|
||||
});
|
||||
|
||||
it('accepts missing implementsApis', async () => {
|
||||
delete (entity as any).spec.implementsApis;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('rejects empty implementsApis', async () => {
|
||||
(entity as any).spec.implementsApis = [''];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/implementsApis/);
|
||||
});
|
||||
|
||||
it('rejects undefined implementsApis', async () => {
|
||||
(entity as any).spec.implementsApis = [undefined];
|
||||
await expect(validator.check(entity)).rejects.toThrow(/implementsApis/);
|
||||
});
|
||||
|
||||
it('accepts no implementsApis', async () => {
|
||||
(entity as any).spec.implementsApis = [];
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('accepts missing providesApis', async () => {
|
||||
delete (entity as any).spec.providesApis;
|
||||
await expect(validator.check(entity)).resolves.toBe(true);
|
||||
|
||||
@@ -29,7 +29,6 @@ const schema = yup.object<Partial<ComponentEntityV1alpha1>>({
|
||||
type: yup.string().required().min(1),
|
||||
lifecycle: yup.string().required().min(1),
|
||||
owner: yup.string().required().min(1),
|
||||
implementsApis: yup.array(yup.string().required()).notRequired(),
|
||||
providesApis: yup.array(yup.string().required()).notRequired(),
|
||||
consumesApis: yup.array(yup.string().required()).notRequired(),
|
||||
})
|
||||
@@ -43,12 +42,6 @@ export interface ComponentEntityV1alpha1 extends Entity {
|
||||
type: string;
|
||||
lifecycle: string;
|
||||
owner: string;
|
||||
/**
|
||||
* @deprecated This field will disappear on Dec 14th, 2020. Please remove
|
||||
* any consuming code. The new field providesApis provides the
|
||||
* same functionality like before.
|
||||
*/
|
||||
implementsApis?: string[];
|
||||
providesApis?: string[];
|
||||
consumesApis?: string[];
|
||||
};
|
||||
|
||||
+1
-18
@@ -67,7 +67,6 @@ describe('BuiltinKindsEntityProcessor', () => {
|
||||
type: 'service',
|
||||
owner: 'o',
|
||||
lifecycle: 'l',
|
||||
implementsApis: ['a'],
|
||||
providesApis: ['b'],
|
||||
consumesApis: ['c'],
|
||||
},
|
||||
@@ -75,7 +74,7 @@ describe('BuiltinKindsEntityProcessor', () => {
|
||||
|
||||
await processor.postProcessEntity(entity, location, emit);
|
||||
|
||||
expect(emit).toBeCalledTimes(8);
|
||||
expect(emit).toBeCalledTimes(6);
|
||||
expect(emit).toBeCalledWith({
|
||||
type: 'relation',
|
||||
relation: {
|
||||
@@ -92,22 +91,6 @@ describe('BuiltinKindsEntityProcessor', () => {
|
||||
target: { kind: 'Group', namespace: 'default', name: 'o' },
|
||||
},
|
||||
});
|
||||
expect(emit).toBeCalledWith({
|
||||
type: 'relation',
|
||||
relation: {
|
||||
source: { kind: 'API', namespace: 'default', name: 'a' },
|
||||
type: 'apiProvidedBy',
|
||||
target: { kind: 'Component', namespace: 'default', name: 'n' },
|
||||
},
|
||||
});
|
||||
expect(emit).toBeCalledWith({
|
||||
type: 'relation',
|
||||
relation: {
|
||||
source: { kind: 'Component', namespace: 'default', name: 'n' },
|
||||
type: 'providesApi',
|
||||
target: { kind: 'API', namespace: 'default', name: 'a' },
|
||||
},
|
||||
});
|
||||
expect(emit).toBeCalledWith({
|
||||
type: 'relation',
|
||||
relation: {
|
||||
|
||||
@@ -134,12 +134,6 @@ export class BuiltinKindsEntityProcessor implements CatalogProcessor {
|
||||
RELATION_OWNED_BY,
|
||||
RELATION_OWNER_OF,
|
||||
);
|
||||
doEmit(
|
||||
component.spec.implementsApis,
|
||||
{ defaultKind: 'API', defaultNamespace: selfRef.namespace },
|
||||
RELATION_PROVIDES_API,
|
||||
RELATION_API_PROVIDED_BY,
|
||||
);
|
||||
doEmit(
|
||||
component.spec.providesApis,
|
||||
{ defaultKind: 'API', defaultNamespace: selfRef.namespace },
|
||||
|
||||
Reference in New Issue
Block a user