Merge backstage/master
Signed-off-by: Kai Szybiak <kaiszybiak@gmail.com>
This commit is contained in:
@@ -1,5 +1,24 @@
|
||||
# @backstage/plugin-api-docs
|
||||
|
||||
## 0.6.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 752a53d94e: Improve theme integration for OpenApi definition
|
||||
- Updated dependencies
|
||||
- @backstage/core-components@0.7.6
|
||||
- @backstage/theme@0.2.14
|
||||
- @backstage/core-plugin-api@0.2.2
|
||||
|
||||
## 0.6.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c982fc12cb: Adjusted some styles in the OpenAPI definition, for elements which were barely readable in dark mode.
|
||||
- Updated dependencies
|
||||
- @backstage/core-plugin-api@0.2.1
|
||||
- @backstage/core-components@0.7.5
|
||||
|
||||
## 0.6.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -160,6 +160,14 @@ by this plugin.
|
||||
Grab a copy of [oauth2-redirect.html](https://github.com/swagger-api/swagger-ui/blob/master/dist/oauth2-redirect.html)
|
||||
and put it in the `app/public/` directory in order to enable Swagger UI to complete this redirection.
|
||||
|
||||
This also may require you to adjust `Content Security Policy` header settings of your Backstage application, so that the script in `oauth2-redirect.html` can be executed. Since the script is static we can add the hash of it directly to our CSP policy, which we do by adding the following to the `csp` section of the app configuration:
|
||||
|
||||
```yaml
|
||||
script-src:
|
||||
- "'self'"
|
||||
- "'sha256-GeDavzSZ8O71Jggf/pQkKbt52dfZkrdNMQ3e+Ox+AkI='" # oauth2-redirect.html
|
||||
```
|
||||
|
||||
#### Configuring your OAuth2 Client
|
||||
|
||||
You'll need to make sure your OAuth2 client has been registered in your OAuth2 Authentication Server (AS)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/plugin-api-docs",
|
||||
"description": "A Backstage plugin that helps represent API entities in the frontend",
|
||||
"version": "0.6.14",
|
||||
"version": "0.6.16",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
@@ -30,13 +30,13 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@asyncapi/react-component": "^1.0.0-next.21",
|
||||
"@asyncapi/react-component": "^1.0.0-next.25",
|
||||
"@backstage/catalog-model": "^0.9.7",
|
||||
"@backstage/core-components": "^0.7.4",
|
||||
"@backstage/core-plugin-api": "^0.2.0",
|
||||
"@backstage/core-components": "^0.7.6",
|
||||
"@backstage/core-plugin-api": "^0.2.2",
|
||||
"@backstage/plugin-catalog": "^0.7.3",
|
||||
"@backstage/plugin-catalog-react": "^0.6.4",
|
||||
"@backstage/theme": "^0.2.13",
|
||||
"@backstage/theme": "^0.2.14",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.57",
|
||||
@@ -53,10 +53,10 @@
|
||||
"swagger-ui-react": "^4.0.0-rc.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "^0.9.0",
|
||||
"@backstage/core-app-api": "^0.1.21",
|
||||
"@backstage/cli": "^0.10.0",
|
||||
"@backstage/core-app-api": "^0.1.24",
|
||||
"@backstage/dev-utils": "^0.2.13",
|
||||
"@backstage/test-utils": "^0.1.22",
|
||||
"@backstage/test-utils": "^0.1.23",
|
||||
"@testing-library/jest-dom": "^5.10.1",
|
||||
"@testing-library/react": "^11.2.5",
|
||||
"@testing-library/user-event": "^13.1.8",
|
||||
|
||||
@@ -16,13 +16,12 @@
|
||||
|
||||
import { ApiEntity } from '@backstage/catalog-model';
|
||||
import { EntityProvider } from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ApiDocsConfig, apiDocsConfigRef } from '../../config';
|
||||
import { OpenApiDefinitionWidget } from '../OpenApiDefinitionWidget';
|
||||
import { ApiDefinitionCard } from './ApiDefinitionCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ApiDefinitionCard />', () => {
|
||||
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
|
||||
@@ -31,10 +30,10 @@ describe('<ApiDefinitionCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(apiDocsConfigRef, apiDocsConfig);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider apis={[[apiDocsConfigRef, apiDocsConfig]]}>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -15,11 +15,10 @@
|
||||
*/
|
||||
|
||||
import { ApiEntity } from '@backstage/catalog-model';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import React from 'react';
|
||||
import { ApiDocsConfig, apiDocsConfigRef } from '../../config';
|
||||
import { ApiTypeTitle } from './ApiTypeTitle';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ApiTypeTitle />', () => {
|
||||
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
|
||||
@@ -28,10 +27,10 @@ describe('<ApiTypeTitle />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(apiDocsConfigRef, apiDocsConfig);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider apis={[[apiDocsConfigRef, apiDocsConfig]]}>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -15,11 +15,7 @@
|
||||
*/
|
||||
|
||||
import { Entity, RELATION_MEMBER_OF } from '@backstage/catalog-model';
|
||||
import {
|
||||
ApiProvider,
|
||||
ApiRegistry,
|
||||
ConfigReader,
|
||||
} from '@backstage/core-app-api';
|
||||
import { ConfigReader } from '@backstage/core-app-api';
|
||||
import { TableColumn, TableProps } from '@backstage/core-components';
|
||||
import {
|
||||
ConfigApi,
|
||||
@@ -34,7 +30,11 @@ import {
|
||||
entityRouteRef,
|
||||
starredEntitiesApiRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { MockStorageApi, wrapInTestApp } from '@backstage/test-utils';
|
||||
import {
|
||||
MockStorageApi,
|
||||
TestApiProvider,
|
||||
wrapInTestApp,
|
||||
} from '@backstage/test-utils';
|
||||
import DashboardIcon from '@material-ui/icons/Dashboard';
|
||||
import { render } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
@@ -88,8 +88,8 @@ describe('ApiCatalogPage', () => {
|
||||
const renderWrapped = (children: React.ReactNode) =>
|
||||
render(
|
||||
wrapInTestApp(
|
||||
<ApiProvider
|
||||
apis={ApiRegistry.from([
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, catalogApi],
|
||||
[configApiRef, configApi],
|
||||
[storageApiRef, storageApi],
|
||||
@@ -98,10 +98,10 @@ describe('ApiCatalogPage', () => {
|
||||
new DefaultStarredEntitiesApi({ storageApi }),
|
||||
],
|
||||
[apiDocsConfigRef, apiDocsConfig],
|
||||
])}
|
||||
]}
|
||||
>
|
||||
{children}
|
||||
</ApiProvider>,
|
||||
</TestApiProvider>,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/catalog/:namespace/:kind/:name': entityRouteRef,
|
||||
|
||||
@@ -21,12 +21,11 @@ import {
|
||||
EntityProvider,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ApiDocsConfig, apiDocsConfigRef } from '../../config';
|
||||
import { ConsumedApisCard } from './ConsumedApisCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ConsumedApisCard />', () => {
|
||||
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
|
||||
@@ -43,13 +42,15 @@ describe('<ConsumedApisCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(catalogApiRef, catalogApi).with(
|
||||
apiDocsConfigRef,
|
||||
apiDocsConfig,
|
||||
);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, catalogApi],
|
||||
[apiDocsConfigRef, apiDocsConfig],
|
||||
]}
|
||||
>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -21,12 +21,11 @@ import {
|
||||
EntityProvider,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ApiDocsConfig, apiDocsConfigRef } from '../../config';
|
||||
import { HasApisCard } from './HasApisCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<HasApisCard />', () => {
|
||||
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
|
||||
@@ -43,13 +42,15 @@ describe('<HasApisCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(catalogApiRef, catalogApi).with(
|
||||
apiDocsConfigRef,
|
||||
apiDocsConfig,
|
||||
);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, catalogApi],
|
||||
[apiDocsConfigRef, apiDocsConfig],
|
||||
]}
|
||||
>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -21,12 +21,11 @@ import {
|
||||
EntityProvider,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ApiDocsConfig, apiDocsConfigRef } from '../../config';
|
||||
import { ProvidedApisCard } from './ProvidedApisCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ProvidedApisCard />', () => {
|
||||
const apiDocsConfig: jest.Mocked<ApiDocsConfig> = {
|
||||
@@ -43,13 +42,15 @@ describe('<ProvidedApisCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(catalogApiRef, catalogApi).with(
|
||||
apiDocsConfigRef,
|
||||
apiDocsConfig,
|
||||
);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[catalogApiRef, catalogApi],
|
||||
[apiDocsConfigRef, apiDocsConfig],
|
||||
]}
|
||||
>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ import {
|
||||
EntityProvider,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ConsumingComponentsCard } from './ConsumingComponentsCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ConsumingComponentsCard />', () => {
|
||||
const catalogApi: jest.Mocked<CatalogApi> = {
|
||||
@@ -39,10 +38,10 @@ describe('<ConsumingComponentsCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(catalogApiRef, catalogApi);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider apis={[[catalogApiRef, catalogApi]]}>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ import {
|
||||
EntityProvider,
|
||||
entityRouteRef,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
|
||||
import { waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { ProvidingComponentsCard } from './ProvidingComponentsCard';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('<ProvidingComponentsCard />', () => {
|
||||
const catalogApi: jest.Mocked<CatalogApi> = {
|
||||
@@ -39,10 +38,10 @@ describe('<ProvidingComponentsCard />', () => {
|
||||
let Wrapper: React.ComponentType;
|
||||
|
||||
beforeEach(() => {
|
||||
const apis = ApiRegistry.with(catalogApiRef, catalogApi);
|
||||
|
||||
Wrapper = ({ children }: { children?: React.ReactNode }) => (
|
||||
<ApiProvider apis={apis}>{children}</ApiProvider>
|
||||
<TestApiProvider apis={[[catalogApiRef, catalogApi]]}>
|
||||
{children}
|
||||
</TestApiProvider>
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -22,18 +22,9 @@ import 'swagger-ui-react/swagger-ui.css';
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
'& .swagger-ui': {
|
||||
fontFamily: 'inherit',
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
color: theme.palette.text.primary,
|
||||
|
||||
[`& .info h1,
|
||||
.info h2,
|
||||
.info h3,
|
||||
.info h4,
|
||||
.info h5,
|
||||
.info h6`]: {
|
||||
fontFamily: 'inherit',
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
[`& .scheme-container`]: {
|
||||
backgroundColor: theme.palette.background.default,
|
||||
},
|
||||
@@ -41,7 +32,7 @@ const useStyles = makeStyles(theme => ({
|
||||
.opblock-tag small,
|
||||
table thead tr td,
|
||||
table thead tr th`]: {
|
||||
fontFamily: 'inherit',
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
color: theme.palette.text.primary,
|
||||
borderColor: theme.palette.divider,
|
||||
},
|
||||
@@ -49,34 +40,30 @@ const useStyles = makeStyles(theme => ({
|
||||
section.models.is-open h4`]: {
|
||||
borderColor: theme.palette.divider,
|
||||
},
|
||||
[`& .opblock .opblock-summary-description,
|
||||
.parameter__type,
|
||||
table.headers td,
|
||||
.model-title,
|
||||
.model .property.primitive,
|
||||
section h3`]: {
|
||||
fontFamily: 'inherit',
|
||||
color: theme.palette.text.secondary,
|
||||
[`& .model-title,
|
||||
.model .renderedMarkdown,
|
||||
.model .description`]: {
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
fontWeight: theme.typography.fontWeightRegular,
|
||||
},
|
||||
[`& .opblock .opblock-summary-operation-id,
|
||||
.opblock .opblock-summary-path,
|
||||
.opblock .opblock-summary-path__deprecated,
|
||||
.opblock .opblock-section-header h4,
|
||||
[`& h1, h2, h3, h4, h5, h6,
|
||||
.errors h4, .error h4, .opblock h4, section.models h4,
|
||||
.response-control-media-type__accept-message,
|
||||
.opblock-summary-description,
|
||||
.opblock-summary-operation-id,
|
||||
.opblock-summary-path,
|
||||
.opblock-summary-path__deprecated,
|
||||
.opblock-external-docs-wrapper,
|
||||
.opblock-section-header .btn,
|
||||
.opblock-section-header>label,
|
||||
.scheme-container .schemes>label,a.nostyle,
|
||||
.parameter__name,
|
||||
.response-col_status,
|
||||
.response-col_links,
|
||||
.responses-inner h4,
|
||||
.responses-inner h5,
|
||||
.opblock-section-header .btn,
|
||||
.tab li,
|
||||
.info li,
|
||||
.info p,
|
||||
.info table,
|
||||
section.models h4,
|
||||
.error .btn,
|
||||
.info .title,
|
||||
table.model tr.description,
|
||||
.property-row`]: {
|
||||
fontFamily: 'inherit',
|
||||
.info .base-url`]: {
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
[`& .opblock .opblock-section-header,
|
||||
@@ -88,22 +75,57 @@ const useStyles = makeStyles(theme => ({
|
||||
.parameter__in`]: {
|
||||
color: theme.palette.text.disabled,
|
||||
},
|
||||
[`& .opblock-description-wrapper p,
|
||||
.opblock-external-docs-wrapper p,
|
||||
.opblock-title_normal p,
|
||||
.response-control-media-type__accept-message,
|
||||
.opblock .opblock-section-header>label,
|
||||
.scheme-container .schemes>label,
|
||||
.info .base-url,
|
||||
.model`]: {
|
||||
color: theme.palette.text.hint,
|
||||
[`& table.model,
|
||||
.parameter__type,
|
||||
.model.model-title,
|
||||
.model-title,
|
||||
.model span,
|
||||
.model .brace-open,
|
||||
.model .brace-close,
|
||||
.model .property.primitive,
|
||||
.model .renderedMarkdown,
|
||||
.model .description,
|
||||
.errors small`]: {
|
||||
color: theme.palette.text.secondary,
|
||||
},
|
||||
[`& .parameter__name.required:after`]: {
|
||||
color: theme.palette.warning.dark,
|
||||
},
|
||||
[`& .prop-type`]: {
|
||||
[`& table.model,
|
||||
table.model .model,
|
||||
.opblock-external-docs-wrapper`]: {
|
||||
fontSize: theme.typography.fontSize,
|
||||
},
|
||||
[`& table.headers td`]: {
|
||||
color: theme.palette.text.primary,
|
||||
fontWeight: theme.typography.fontWeightRegular,
|
||||
},
|
||||
[`& .model-hint`]: {
|
||||
color: theme.palette.text.hint,
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
},
|
||||
[`& .opblock-summary-method,
|
||||
.info a`]: {
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
},
|
||||
[`& .info, .opblock, .tab`]: {
|
||||
[`& li, p`]: {
|
||||
fontFamily: theme.typography.fontFamily,
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
},
|
||||
[`& a`]: {
|
||||
color: theme.palette.primary.main,
|
||||
},
|
||||
[`& .renderedMarkdown code`]: {
|
||||
color: theme.palette.secondary.light,
|
||||
},
|
||||
[`& .property-row td:first-child`]: {
|
||||
color: theme.palette.text.primary,
|
||||
},
|
||||
[`& span.prop-type`]: {
|
||||
color: theme.palette.success.light,
|
||||
},
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user