diff --git a/.changeset/slimy-horses-do.md b/.changeset/slimy-horses-do.md
new file mode 100644
index 0000000000..196c47c988
--- /dev/null
+++ b/.changeset/slimy-horses-do.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-api-docs': patch
+---
+
+Add dedicated gRPC api definition widget
diff --git a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx
index baccf09de9..3b7aa406d4 100644
--- a/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx
+++ b/plugins/api-docs/src/components/ApiDefinitionCard/ApiDefinitionWidget.tsx
@@ -17,6 +17,7 @@ import React from 'react';
import { AsyncApiDefinitionWidget } from '../AsyncApiDefinitionWidget';
import { GraphQlDefinitionWidget } from '../GraphQlDefinitionWidget';
import { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget';
+import { GrpcApiDefinitionWidget } from '../GrpcApiDefinitionWidget';
export type ApiDefinitionWidget = {
type: string;
@@ -51,5 +52,12 @@ export function defaultDefinitionWidgets(): ApiDefinitionWidget[] {
),
},
+ {
+ type: 'grpc',
+ title: 'gRPC',
+ component: definition => (
+
+ ),
+ },
];
}
diff --git a/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.test.tsx b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.test.tsx
new file mode 100644
index 0000000000..046614fc91
--- /dev/null
+++ b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.test.tsx
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2020 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { renderInTestApp } from '@backstage/test-utils';
+import React from 'react';
+import { GrpcApiDefinitionWidget } from './GrpcApiDefinitionWidget';
+
+describe('', () => {
+ it('renders plain text', async () => {
+ const { getAllByText } = await renderInTestApp(
+ ,
+ );
+
+ expect(
+ getAllByText((_text, element) => element?.textContent === 'Hello World')
+ .length,
+ ).toBeGreaterThan(0);
+ });
+});
diff --git a/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.tsx b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.tsx
new file mode 100644
index 0000000000..c5f9b071ef
--- /dev/null
+++ b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/GrpcApiDefinitionWidget.tsx
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2020 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { CodeSnippet } from '@backstage/core-components';
+import { useTheme } from '@material-ui/core/styles';
+import { BackstageTheme } from '@backstage/theme';
+
+export type GrpcApiDefinitionWidgetProps = {
+ definition: string;
+};
+
+export const GrpcApiDefinitionWidget = (
+ props: GrpcApiDefinitionWidgetProps,
+) => {
+ const theme = useTheme();
+ return (
+
+ );
+};
diff --git a/plugins/api-docs/src/components/GrpcApiDefinitionWidget/index.ts b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/index.ts
new file mode 100644
index 0000000000..f9ed12d111
--- /dev/null
+++ b/plugins/api-docs/src/components/GrpcApiDefinitionWidget/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2020 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { GrpcApiDefinitionWidget } from './GrpcApiDefinitionWidget';
+export type { GrpcApiDefinitionWidgetProps } from './GrpcApiDefinitionWidget';