@backstage/plugin-api-docs 0.14.7-next.2 → 0.14.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,41 +1,10 @@
1
1
  # @backstage/plugin-api-docs
2
2
 
3
- ## 0.14.7-next.2
3
+ ## 0.14.8
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - Updated dependencies
8
- - @backstage/plugin-catalog@2.0.11-next.2
9
- - @backstage/core-components@0.18.16-next.1
10
- - @backstage/ui@0.20.0-next.0
11
- - @backstage/frontend-plugin-api@0.19.0-next.2
12
- - @backstage/catalog-model@1.10.3-next.0
13
- - @backstage/core-plugin-api@1.12.12-next.2
14
- - @backstage/plugin-catalog-react@4.0.0-next.2
15
- - @backstage/plugin-catalog-common@1.2.2-next.0
16
- - @backstage/plugin-permission-react@0.5.7-next.1
17
-
18
- ## 0.14.7-next.1
19
-
20
- ### Patch Changes
21
-
22
- - Updated dependencies
23
- - @backstage/core-plugin-api@1.12.12-next.1
24
- - @backstage/frontend-plugin-api@0.19.0-next.1
25
- - @backstage/plugin-catalog@2.0.11-next.1
26
- - @backstage/plugin-catalog-react@4.0.0-next.1
27
-
28
- ## 0.14.7-next.0
29
-
30
- ### Patch Changes
31
-
32
- - Updated dependencies
33
- - @backstage/frontend-plugin-api@0.18.3-next.0
34
- - @backstage/core-plugin-api@1.12.12-next.0
35
- - @backstage/plugin-catalog@2.0.11-next.0
36
- - @backstage/plugin-catalog-react@4.0.0-next.0
37
- - @backstage/core-components@0.18.16-next.0
38
- - @backstage/plugin-permission-react@0.5.7-next.0
7
+ - 640f025: The AsyncAPI definition widget no longer resolves external references by default. References to whole external documents still render, with a placeholder naming the document that was not loaded; references that point into an external document (using a `#` fragment) fail to render with an error naming the reference. To resolve external references — for example to reach internal schema registries that require authentication — provide the `resolvers` prop to enable external reference resolution.
39
8
 
40
9
  ## 0.14.6
41
10
 
package/README.md CHANGED
@@ -270,7 +270,7 @@ the `supportedSubmitMethods` parameter.
270
270
 
271
271
  ### Custom Resolvers for AsyncApi
272
272
 
273
- You can override the default http/https resolvers, for example to add authentication to requests to internal schema registries by providing the `resolvers` prop to the `AsyncApiDefinitionWidget`. This is an example:
273
+ External references in AsyncAPI definitions are not resolved by default, since definitions are provided by catalog entity content. References to whole external documents still render, with a placeholder naming the document that was not loaded; references that point into an external document (using a `#` fragment) fail to render with an error naming the reference. To opt in to resolving external references — for example to reach internal schema registries that require authentication — provide the `resolvers` prop to the `AsyncApiDefinitionWidget`. This is an example:
274
274
 
275
275
  ```tsx
276
276
  ...
@@ -128,24 +128,16 @@ const useStyles = makeStyles((theme) => ({
128
128
  }
129
129
  }
130
130
  }));
131
- const httpsFetchResolver = {
132
- schema: "https",
131
+ const createExternalRefResolver = (schema) => ({
132
+ schema,
133
133
  order: 1,
134
134
  canRead: true,
135
135
  async read(uri) {
136
- const response = await fetch(uri.toString());
137
- return response.text();
136
+ return JSON.stringify({
137
+ description: `External reference not resolved: ${uri.toString()}`
138
+ });
138
139
  }
139
- };
140
- const httpFetchResolver = {
141
- schema: "http",
142
- order: 1,
143
- canRead: true,
144
- async read(uri) {
145
- const response = await fetch(uri.toString());
146
- return response.text();
147
- }
148
- };
140
+ });
149
141
  const AsyncApiDefinition = ({
150
142
  definition,
151
143
  resolvers
@@ -157,7 +149,10 @@ const AsyncApiDefinition = ({
157
149
  parserOptions: {
158
150
  __unstable: {
159
151
  resolver: {
160
- resolvers: [httpsFetchResolver, httpFetchResolver]
152
+ resolvers: [
153
+ createExternalRefResolver("https"),
154
+ createExternalRefResolver("http")
155
+ ]
161
156
  }
162
157
  }
163
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3, code': {\n color: theme.palette.text.primary,\n },\n '& a': {\n color: theme.palette.link,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\nconst httpsFetchResolver: AsyncApiResolver = {\n schema: 'https',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\nconst httpFetchResolver: AsyncApiResolver = {\n schema: 'http',\n order: 1,\n canRead: true,\n async read(uri: any) {\n const response = await fetch(uri.toString());\n return response.text();\n },\n};\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [httpsFetchResolver, httpFetchResolver],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,UAAA,EAAY,SAAA;AAAA,IACZ,aAAA,EAAe;AAAA,MACb,UAAA,EAAY;AAAA,KACd;AAAA,IACA,aAAA,EAAe;AAAA,MACb,GAAG,MAAM,UAAA,CAAW;AAAA,KACtB;AAAA,IACA,OAAA,EAAS;AAAA,MACP,GAAG,MAAM,UAAA,CAAW;AAAA,KACtB;AAAA,IACA,WAAA,EAAa;AAAA,MACX,WAAA,EAAa,KAAA,CAAM,KAAA,CAAM,OAAA,CAAQ,QAAQ,GAAG;AAAA,KAC9C;AAAA,IACA,cAAA,EAAgB;AAAA,MACd,QAAA,EAAU;AAAA,KACZ;AAAA,IACA,aAAA,EAAe;AAAA,MACb,OAAA,EAAS;AAAA,KACX;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,MAAA,CAAO;AAAA,KACxC;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,KACtC;AAAA,IACA,gBAAA,EAAkB;AAAA,MAChB,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,KACtC;AAAA,IACA,kBAAA,EAAoB;AAAA,MAClB,eAAA,EAAiB,KAAA,CAAM,OAAA,CAAQ,OAAA,CAAQ;AAAA,KACzC;AAAA,IACA,iBAAA,EAAmB;AAAA,MACjB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,MAAA,C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AAa,CAAA,EAAG,OAAA,CAAQ,IAAI,CAAA,CAAA,EAChC,KAAA,CAAM,OAAA,CAAQ,IAAA,KAAS,MAAA,GAAS,OAAA,CAAQ,IAAA,GAAO,EACjD,CAAA,CAAA;AAEA,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,aAAA,EAAe;AAAA,MACb,UAAA,EAAY;AAAA,QACV,QAAA,EAAU;AAAA,UACR,SAAA,EAAW,CAAC,kBAAA,EAAoB,iBAAiB;AAAA;AACnD;AACF;AACF,GACF;AAGA,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,MAAA,CAAO,aAAA,CAAc,UAAA,CAAW,QAAA,CAAS,SAAA,GAAY,SAAA;AAAA,EACvD;AAEA,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAW,UAAA,EACd,8BAAC,QAAA,EAAA,EAAS,MAAA,EAAQ,UAAA,EAAY,MAAA,EAAgB,CAAA,EAChD,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"AsyncApiDefinition.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinition.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport AsyncApi from '@asyncapi/react-component';\nimport '@asyncapi/react-component/styles/default.css';\nimport { makeStyles, alpha, darken } from '@material-ui/core/styles';\nimport { useTheme } from '@material-ui/core/styles';\n\n/** @public */\nexport type AsyncApiResolver = {\n schema: string;\n order: number;\n canRead: boolean;\n read(uri: any): Promise<string>;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n fontFamily: 'inherit',\n '& .bg-white': {\n background: 'none',\n },\n '& .text-4xl': {\n ...theme.typography.h3,\n },\n ' & h2': {\n ...theme.typography.h4,\n },\n '& .border': {\n borderColor: alpha(theme.palette.border, 0.1),\n },\n '& .min-w-min': {\n minWidth: 'fit-content',\n },\n '& .examples': {\n padding: '1rem',\n },\n '& .bg-teal-500': {\n backgroundColor: theme.palette.status.ok,\n },\n '& .bg-blue-500': {\n backgroundColor: theme.palette.info.main,\n },\n '& .bg-blue-400': {\n backgroundColor: theme.palette.info.light,\n },\n '& .bg-indigo-400': {\n backgroundColor: theme.palette.warning.main,\n },\n '& .text-teal-50': {\n color: theme.palette.status.ok,\n },\n '& .text-red-600': {\n color: theme.palette.error.main,\n },\n '& .text-orange-600': {\n color: theme.palette.warning.main,\n },\n '& .text-teal-500': {\n color: theme.palette.status.ok,\n },\n '& .text-blue-500': {\n color: theme.palette.info.main,\n },\n '& .-rotate-90': {\n '--tw-rotate': '0deg',\n },\n '& button': {\n ...theme.typography.button,\n borderRadius: theme.shape.borderRadius,\n color: theme.palette.primary.main,\n // override whatever may be in the theme's typography to ensure consistency with asyncapi\n textTransform: 'inherit',\n },\n '& a': {\n color: theme.palette.link,\n },\n '& a.no-underline': {\n ...theme.typography.button,\n background: 'none',\n boxSizing: 'border-box',\n minWidth: 64,\n borderRadius: theme.shape.borderRadius,\n transition: theme.transitions.create(\n ['background-color', 'box-shadow', 'border'],\n {\n duration: theme.transitions.duration.short,\n },\n ),\n padding: '5px 15px',\n color: theme.palette.primary.main,\n border: `1px solid ${alpha(theme.palette.primary.main, 0.5)}`,\n '&:hover': {\n textDecoration: 'none',\n border: `1px solid ${theme.palette.primary.main}`,\n backgroundColor: alpha(\n theme.palette.primary.main,\n theme.palette.action.hoverOpacity,\n ),\n },\n },\n '& li.no-underline': {\n '& a': {\n textDecoration: 'none',\n color: theme.palette.getContrastText(theme.palette.primary.main),\n },\n },\n },\n dark: {\n '& svg': {\n fill: theme.palette.text.primary,\n },\n '& .prose': {\n color: theme.palette.text.secondary,\n '& h3, code': {\n color: theme.palette.text.primary,\n },\n '& a': {\n color: theme.palette.link,\n },\n },\n '& .bg-gray-100, .bg-gray-200': {\n backgroundColor: theme.palette.background.default,\n },\n '& .text-gray-600': {\n color: theme.palette.grey['50'],\n },\n '& .text-gray-700': {\n color: theme.palette.grey['100'],\n },\n '& .panel--right': {\n background: darken(theme.palette.navigation.background, 0.1),\n },\n '& .examples': {\n backgroundColor: darken(theme.palette.navigation.background, 0.1),\n '& pre': {\n backgroundColor: darken(theme.palette.background.default, 0.2),\n },\n },\n },\n}));\n\n// Definition content comes from catalog entities whose origin isn't necessarily\n// trusted, so external references are not resolved by default. Resolving the\n// reference to a small valid document (rather than throwing or declining)\n// keeps the parser from falling back to its built-in http/https readers, which\n// would fetch the reference from the viewer's browser, while letting the rest\n// of the definition render with a visible placeholder at the unresolved spot.\n// Use the `resolvers` prop to opt in to external reference resolution.\nconst createExternalRefResolver = (schema: string): AsyncApiResolver => ({\n schema,\n order: 1,\n canRead: true,\n async read(uri: any) {\n return JSON.stringify({\n description: `External reference not resolved: ${uri.toString()}`,\n });\n },\n});\n\ntype Props = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\nexport const AsyncApiDefinition = ({\n definition,\n resolvers,\n}: Props): JSX.Element => {\n const classes = useStyles();\n const theme = useTheme();\n const classNames = `${classes.root} ${\n theme.palette.type === 'dark' ? classes.dark : ''\n }`;\n\n const config = {\n parserOptions: {\n __unstable: {\n resolver: {\n resolvers: [\n createExternalRefResolver('https'),\n createExternalRefResolver('http'),\n ],\n },\n },\n },\n };\n\n // Overwrite default resolvers if custom ones are set\n if (resolvers) {\n config.parserOptions.__unstable.resolver.resolvers = resolvers;\n }\n\n return (\n <div className={classNames}>\n <AsyncApi schema={definition} config={config} />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAA,KAAA,MAAU;AAAA,EACrC,IAAA,EAAM;AAAA,IACJ,UAAA,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,UAAA,EAAY,MAAA,EAAgB,CAAA,EAChD,CAAA;AAEJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Progress } from '@backstage/core-components';\nimport { lazy, Suspense } from 'react';\nimport { AsyncApiResolver } from './AsyncApiDefinition';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n resolvers?: AsyncApiResolver[];\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;;AAsBA,MAAM,sBAAA,GAAyB,IAAA;AAAA,EAAK,MAClC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAA,CAAA,MAAM;AAAA,IACxC,SAAS,CAAA,CAAE;AAAA,GACb,CAAE;AACJ,CAAA;AASO,MAAM,wBAAA,GAA2B,CACtC,KAAA,KACG;AACH,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,kBAAU,GAAA,CAAC,QAAA,EAAA,EAAS,GAC5B,QAAA,kBAAA,GAAA,CAAC,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CAAA,EACrC,CAAA;AAEJ;;"}
1
+ {"version":3,"file":"AsyncApiDefinitionWidget.esm.js","sources":["../../../src/components/AsyncApiDefinitionWidget/AsyncApiDefinitionWidget.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Progress } from '@backstage/core-components';\nimport { lazy, Suspense } from 'react';\nimport { AsyncApiResolver } from './AsyncApiDefinition';\n\n// The asyncapi component and related CSS has a significant size, only load it\n// if the element is actually used.\nconst LazyAsyncApiDefinition = lazy(() =>\n import('./AsyncApiDefinition').then(m => ({\n default: m.AsyncApiDefinition,\n })),\n);\n\n/** @public */\nexport type AsyncApiDefinitionWidgetProps = {\n definition: string;\n /**\n * Custom reference resolvers, provided to opt in to resolving external\n * references in the definition. External references are not resolved by\n * default.\n */\n resolvers?: AsyncApiResolver[];\n};\n\n/** @public */\nexport const AsyncApiDefinitionWidget = (\n props: AsyncApiDefinitionWidgetProps,\n) => {\n return (\n <Suspense fallback={<Progress />}>\n <LazyAsyncApiDefinition {...props} />\n </Suspense>\n );\n};\n"],"names":[],"mappings":";;;;AAsBA,MAAM,sBAAA,GAAyB,IAAA;AAAA,EAAK,MAClC,OAAO,6BAAsB,CAAA,CAAE,KAAK,CAAA,CAAA,MAAM;AAAA,IACxC,SAAS,CAAA,CAAE;AAAA,GACb,CAAE;AACJ,CAAA;AAcO,MAAM,wBAAA,GAA2B,CACtC,KAAA,KACG;AACH,EAAA,uBACE,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,kBAAU,GAAA,CAAC,QAAA,EAAA,EAAS,GAC5B,QAAA,kBAAA,GAAA,CAAC,sBAAA,EAAA,EAAwB,GAAG,KAAA,EAAO,CAAA,EACrC,CAAA;AAEJ;;"}
package/dist/index.d.ts CHANGED
@@ -145,6 +145,11 @@ type AsyncApiResolver = {
145
145
  /** @public */
146
146
  type AsyncApiDefinitionWidgetProps = {
147
147
  definition: string;
148
+ /**
149
+ * Custom reference resolvers, provided to opt in to resolving external
150
+ * references in the definition. External references are not resolved by
151
+ * default.
152
+ */
148
153
  resolvers?: AsyncApiResolver[];
149
154
  };
150
155
  /** @public */
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-api-docs";
2
- var version = "0.14.7-next.2";
2
+ var version = "0.14.8";
3
3
  var description = "A Backstage plugin that helps represent API entities in the frontend";
4
4
  var backstage = {
5
5
  role: "frontend-plugin",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-api-docs",
3
- "version": "0.14.7-next.2",
3
+ "version": "0.14.8",
4
4
  "description": "A Backstage plugin that helps represent API entities in the frontend",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -66,15 +66,15 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@asyncapi/react-component": "^2.3.3",
69
- "@backstage/catalog-model": "1.10.3-next.0",
70
- "@backstage/core-components": "0.18.16-next.1",
71
- "@backstage/core-plugin-api": "1.12.12-next.2",
72
- "@backstage/frontend-plugin-api": "0.19.0-next.2",
73
- "@backstage/plugin-catalog": "2.0.11-next.2",
74
- "@backstage/plugin-catalog-common": "1.2.2-next.0",
75
- "@backstage/plugin-catalog-react": "4.0.0-next.2",
76
- "@backstage/plugin-permission-react": "0.5.7-next.1",
77
- "@backstage/ui": "0.20.0-next.0",
69
+ "@backstage/catalog-model": "^1.10.2",
70
+ "@backstage/core-components": "^0.18.15",
71
+ "@backstage/core-plugin-api": "^1.12.11",
72
+ "@backstage/frontend-plugin-api": "^0.18.2",
73
+ "@backstage/plugin-catalog": "^2.0.10",
74
+ "@backstage/plugin-catalog-common": "^1.2.1",
75
+ "@backstage/plugin-catalog-react": "^3.3.0",
76
+ "@backstage/plugin-permission-react": "^0.5.6",
77
+ "@backstage/ui": "^0.19.0",
78
78
  "@graphiql/react": "0.29.0",
79
79
  "@material-ui/core": "^4.12.2",
80
80
  "@material-ui/icons": "^4.9.1",
@@ -87,11 +87,11 @@
87
87
  "zod": "^4.0.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@backstage/cli": "0.36.8-next.2",
91
- "@backstage/core-app-api": "1.20.7-next.2",
92
- "@backstage/dev-utils": "1.1.29-next.1",
93
- "@backstage/frontend-test-utils": "0.7.0-next.2",
94
- "@backstage/test-utils": "1.7.24-next.1",
90
+ "@backstage/cli": "^0.36.7",
91
+ "@backstage/core-app-api": "^1.20.6",
92
+ "@backstage/dev-utils": "^1.1.28",
93
+ "@backstage/frontend-test-utils": "^0.6.5",
94
+ "@backstage/test-utils": "^1.7.23",
95
95
  "@testing-library/dom": "^10.0.0",
96
96
  "@testing-library/jest-dom": "^6.0.0",
97
97
  "@testing-library/react": "^16.0.0",