Closed jesuspaletaisl closed 1 week ago
@jesuspaletaisl ! great report
https://github.com/scalar/scalar/blob/main/packages/docusaurus/src/index.ts#L24
this line will defs do it, we should just load it as text and pass it in :)
edit will get this fixed up!
Perfect!
BTW, is configuration.spec.content not an option in this plugin?
Using directly Scalar I see two options spec.url and spec.content (for files),
will be the "content" option added in the future to load files directly ?
I think you’re right, we should just pass the configuration and fetch the specification in the frontend.
Maybe there’s a reason we do this in the plugin @amritk? If we have to do it in the plugin, we chould use the fetchSpecFromUrl
helper: https://github.com/scalar/scalar/blob/main/packages/oas-utils/src/helpers/fetchSpecFromUrl.ts
no reason! We can change it @hanspagel
This was fixed in #2159 :)
What happens?
Using the Docusaurus plugin with a YAML file shows this error:
SyntaxError: Unexpected token 'o', "openapi: 3"... is not valid JSON
I have tried the same YAML file in the Scalar website and with others plugins and it is working correctly but with the Docusaurus plugin it asks for a JSON file.
The plugin is working well with JSON files.
What did you expect to happen?
The plugin should accept both URLs for YAML and JSON files.
How can we reproduce the issue?
Add the plugin configuration in the file "docusaurus.config.ts" as explained in the docs:
`import type { ScalarOptions } from '@scalar/docusaurus'
plugins: [ [ '@scalar/docusaurus', { label: 'Scalar', route: '/scalar', configuration: { spec: { url: 'https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml', }, }, } as ScalarOptions, ], ], `
After starting the project with "npm start" the terminal logs print this error:
[ERROR] Site reload failure SyntaxError: Unexpected token 'o', "openapi: 3"... is not valid JSON at JSON.parse (<anonymous>)
OpenAPI Document
No response