fastify not rendering an API reference for a given OpenAPI/Swagger spec URL #1702
-
Hello, I have followed all the steps from the following link: https://github.com/scalar/scalar/blob/main/documentation/fastify.md It works to get the information automatically from fastify.swagger, but if I want to use an external API reference it does not load anything in the browser. I have added the following configuration: fastify.register(require('@scalar/fastify-api-reference'), { My openapi.json file is in the same directory as my index.js. Also, I have removed the code related to fastify.register(FastifySwagger ..) and fastify.put( .. ) and nothing, there is still no information exposed, although any other configurations work aside from "isEditable: true" which does not allow me to make any changes. Finally, I also tried using spec: { content: '{ … }' }, but any content json or yaml is not accepted and there is no specification regarding how it should be written. So I would appreciate any clue from someone to help me. I am very new to justify and I am learning about this topic. Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
thanks for reporting this @cristianabs ! is there anything in your console, are you using helmet? ✨ just trying to see if theres an error message in the console to debug cause i could get it running locally 🤔 |
Beta Was this translation helpful? Give feedback.
-
Hi @marclave, I am not using helmet and my console is empty, my terminal is showing the following in the image: And I don't have anything else, I am literally following the steps written in this document: https://github.com/scalar/scalar/blob/main/documentation/fastify.md Thanks |
Beta Was this translation helpful? Give feedback.
-
hey @marclave yes it works the same as in the documentation, the issue I find is when I am trying to use an external openapi.json file and not the information in the code under fastify.put, because it is the only information present in the web browser. I mean this part of the code: await fastify.register(ScalarApiReference, { Is not fetching the data from the URL (local file I reckon) |
Beta Was this translation helpful? Give feedback.
@marclave sorry for the confusion, perfect now it is working!! thank you :)