You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The OpenAPI 3.0.3 API definition I am trying to integrate into a project is served from API server as yaml. That yml file is valid, e.g. it opens and renders without issues when I try it online via https://redocly.github.io/redoc/. I am using internal http tools to fetch it's raw content due to JWT authentication. So, I am trying to render the docs via React component, like this:
import { observer } from 'mobx-react'
import { useViewModelFactory } from 'mobx-react-viewmodel'
import { ApiDocPageViewModel } from './api_doc.page.vm.ts'
import { RedocStandalone } from 'redoc';
export const ApiDocPage = observer(function ApiDocPage() {
const { spec } = useViewModelFactory(() => new ApiDocPageViewModel())
return (
<RedocStandalone spec={spec} />
)
})
The important part is the <RedocStandalone spec={spec} /> section. I checked the spec value and indeed it is a string that contains the API specification, e.g. starts like this:
Error: Unsupported specification
at detectSpec (http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:21531:13)
at http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36716:56
at Generator.next (<anonymous>)
at http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36632:71
at new Promise (<anonymous>)
at __awaiter (http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36614:14)
at bundleDocument (http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36714:14)
at http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36701:16
at Generator.next (<anonymous>)
at http://localhost:4010/node_modules/.vite/deps/redoc.js?v=7192a3a7:36632:71
The OpenAPI 3.0.3 API definition I am trying to integrate into a project is served from API server as
yaml
. That yml file is valid, e.g. it opens and renders without issues when I try it online via https://redocly.github.io/redoc/. I am using internal http tools to fetch it's raw content due to JWT authentication. So, I am trying to render the docs via React component, like this:The important part is the
<RedocStandalone spec={spec} />
section. I checked thespec
value and indeed it is a string that contains the API specification, e.g. starts like this:However, this results in:
I kind of traced this error to https://github.com/Redocly/redocly-cli/blob/main/packages/core/src/oas-types.ts#L103, but not sure if it applies here. Seems it indeed can not recognize the API doc/spec flavor. Which is odd given it works correctly on https://redocly.github.io/redoc. I am using
"redoc": "^2.1.3"
dependency.Any idea on what may be wrong in my setup?
The text was updated successfully, but these errors were encountered: