fix(apidocs): move type AsyncApiResolver and config to AsyncApiDefinition component
Signed-off-by: Simon Stamm <simon.stamm@tui.com>
This commit is contained in:
@@ -19,7 +19,14 @@ import '@asyncapi/react-component/styles/default.css';
|
||||
import { makeStyles, alpha, darken } from '@material-ui/core/styles';
|
||||
import React from 'react';
|
||||
import { useTheme } from '@material-ui/core/styles';
|
||||
import { AsyncApiResolver } from './AsyncApiDefinitionWidget';
|
||||
|
||||
/** @public */
|
||||
export type AsyncApiResolver = {
|
||||
schema: string;
|
||||
order: number;
|
||||
canRead: boolean;
|
||||
read(uri: any): Promise<string>;
|
||||
};
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
@@ -164,16 +171,6 @@ const httpFetchResolver: AsyncApiResolver = {
|
||||
},
|
||||
};
|
||||
|
||||
const config = {
|
||||
parserOptions: {
|
||||
__unstable: {
|
||||
resolver: {
|
||||
resolvers: [httpsFetchResolver, httpFetchResolver],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
type Props = {
|
||||
definition: string;
|
||||
resolvers?: AsyncApiResolver[];
|
||||
@@ -189,6 +186,16 @@ export const AsyncApiDefinition = ({
|
||||
theme.palette.type === 'dark' ? classes.dark : ''
|
||||
}`;
|
||||
|
||||
const config = {
|
||||
parserOptions: {
|
||||
__unstable: {
|
||||
resolver: {
|
||||
resolvers: [httpsFetchResolver, httpFetchResolver],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Overwrite default resolvers if custom ones are set
|
||||
if (resolvers) {
|
||||
config.parserOptions.__unstable.resolver.resolvers = resolvers;
|
||||
|
||||
+1
-8
@@ -16,6 +16,7 @@
|
||||
|
||||
import { Progress } from '@backstage/core-components';
|
||||
import React, { Suspense } from 'react';
|
||||
import { AsyncApiResolver } from './AsyncApiDefinition';
|
||||
|
||||
// The asyncapi component and related CSS has a significant size, only load it
|
||||
// if the element is actually used.
|
||||
@@ -25,14 +26,6 @@ const LazyAsyncApiDefinition = React.lazy(() =>
|
||||
})),
|
||||
);
|
||||
|
||||
/** @public */
|
||||
export type AsyncApiResolver = {
|
||||
schema: string;
|
||||
order: number;
|
||||
canRead: boolean;
|
||||
read(uri: any): Promise<string>;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type AsyncApiDefinitionWidgetProps = {
|
||||
definition: string;
|
||||
|
||||
@@ -15,7 +15,5 @@
|
||||
*/
|
||||
|
||||
export { AsyncApiDefinitionWidget } from './AsyncApiDefinitionWidget';
|
||||
export type {
|
||||
AsyncApiDefinitionWidgetProps,
|
||||
AsyncApiResolver,
|
||||
} from './AsyncApiDefinitionWidget';
|
||||
export type { AsyncApiDefinitionWidgetProps } from './AsyncApiDefinitionWidget';
|
||||
export type { AsyncApiResolver } from './AsyncApiDefinition';
|
||||
|
||||
Reference in New Issue
Block a user