Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds API documentation from Swagger #263

Closed
wants to merge 6 commits into from

Conversation

dayvsonspacca
Copy link

The main changes include the creation of a route called /docs, not accessible through the routes / or /:type, which stores the Swagger HTML file responsible for displaying the documentation. Additionally, a new script has been created to automatically generate the swagger.yml file based on what is in the data folder, creating the endpoints.

To generate the file:

npm run gen:swagger

Simply navigate to the /docs endpoint to view the documentation.

It was necessary to disable the Content Security Policy (CSP) in Helmet so that the HTML file can request the necessary CDN files to build the documentation.

The last change was to use lint and format, which resulted in many changes in files that apparently were not formatted previously.

Important to mention that the /boss endpoint was not included in the documentation because as of the current date 02/28/2024, it is not functioning properly.

Copy link
Collaborator

@M4GICB M4GICB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • this pr needs to resolve merge conflicts
  • it would be good to undo all of the linting changes
    • the scope of this PR should focus solely on the swagger documentation updates

@dayvsonspacca
Copy link
Author

still need all the lints to be undone?

@man90es
Copy link
Collaborator

man90es commented May 14, 2024

While I generally agree that PRs should focus on one change, I'd let this formatting fix slide. It's a good change to have standardised formatting

Copy link
Collaborator

@man90es man90es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so a couple of things from me:

  • Isn't it one of the most common questions on Discord how to get images? It's a part that remains undocumented
  • This PR implies that we generate documentation once and then just store it in git. This is a bit pointless imo. A better approach would be to add the yaml file to .gitignore and add generation script call to Dockerfile. Or, if we want to store it in git, it would be better to write it manually, verbosely explaining every feature
  • I believe that Content Security Policy thing is not necessary. Have you tried https://redocly.com? I use it on another project without turning off security

@dayvsonspacca
Copy link
Author

Now that you brought up these points, this script actually became a bit useless 🙃.

I'll be closing this PR and I'll be thinking about something simpler for this documentation with this tool that you recommended or with the scalar that I've already used and found interesting.

I will come back soon with this documentation 🤙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants