Skip to content

Commit

Permalink
Remove implementsApis
Browse files Browse the repository at this point in the history
This was deprecated in #3449. This should not be merged sooner then Dec 14th, 2020!
  • Loading branch information
Fox32 committed Dec 7, 2020
1 parent a1fffce commit ac3560b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 68 deletions.
7 changes: 7 additions & 0 deletions .changeset/thirty-fans-hammer.md
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 0 additions & 15 deletions docs/features/software-catalog/descriptor-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spec:
type: service
lifecycle: experimental
owner: team-c
implementsApis:
providesApis:
- petstore
- streetlights
- hello-world
21 changes: 0 additions & 21 deletions packages/catalog-model/src/kinds/ComponentEntityV1alpha1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ describe('ComponentV1alpha1Validator', () => {
type: 'service',
lifecycle: 'production',
owner: 'me',
implementsApis: ['api-0'],
providesApis: ['api-0'],
consumesApis: ['api-0'],
},
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions packages/catalog-model/src/kinds/ComponentEntityV1alpha1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
})
Expand All @@ -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[];
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ describe('BuiltinKindsEntityProcessor', () => {
type: 'service',
owner: 'o',
lifecycle: 'l',
implementsApis: ['a'],
providesApis: ['b'],
consumesApis: ['c'],
},
};

await processor.postProcessEntity(entity, location, emit);

expect(emit).toBeCalledTimes(8);
expect(emit).toBeCalledTimes(6);
expect(emit).toBeCalledWith({
type: 'relation',
relation: {
Expand All @@ -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: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit ac3560b

Please sign in to comment.