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

Add SwaggerUi to replace Apiary #517

Merged
merged 7 commits into from
Nov 17, 2023
Merged

Add SwaggerUi to replace Apiary #517

merged 7 commits into from
Nov 17, 2023

Conversation

blacksam07
Copy link
Contributor

Board:


Description:

  • Use Rswag to expose generated swagger documentation
  • Expose api-docs endpoint with basic-auth

Notes:

  • Create a PR in rspec-openapi to include the project title

Tasks:

  • Expose generate openapi.yaml doc with SwaggerUI
  • The API Docs can be accessed through the Rails app
  • The API Docs are not publicly accessible

Risk:


Preview:

image

doc/openapi.yaml Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@santib
Copy link
Member

santib commented Nov 9, 2023

Apiary should no longer be mentioned in the README. Also, please add something in docs/api_documentation.md about the API Docs UI

c.swagger_endpoint "/api-docs/openapi#{ENV.fetch('TEST_ENV_NUMBER', '')}.yaml", 'API V1 Docs'

# Add Basic Auth in case your API is private
c.basic_auth_enabled = true
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we have both? public and private endpoints?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the way that rswag works, we need to define the API endpoints that will use it for UI section

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if that answers my question.
If we build an app that has public endpoints, we need to also have a "public" documentation that anyone can see in order to understand how the API works.

So the question is, is it possible to only scope the auth to a subset of our endpoints and not the whole app?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@JulianPasquale Oh Oh, I understood that you are asking about rswag sorry

  • I'm not sure, but I looked in the Swagger documentation and didn't find anything about adding auth only for a group of endpoints, also following the ticket scope I included the authorization here, but we can disable it by setting the value to "false". `

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool. I think it would be nice to explore it so we can allow the mix of public and private docs. Not a blocker since auth can be disabled 👍

Copy link
Member

Choose a reason for hiding this comment

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

I think this is a good discussion, maybe we can follow up in a meeting? I think what we need to answer is: who are we expecting to be the consumers of these endpoints?

  • Frontend devs?
  • Backend devs from other teams/apps?
  • External products/services?

config/routes.rb Outdated Show resolved Hide resolved
Copy link
Member

@santib santib left a comment

Choose a reason for hiding this comment

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

Great job, thanks for bringing this improvement to the rails_api_base.

Last thing: remove the reference to Apiary in the README.md

Thanks!

@santib santib requested a review from a team November 14, 2023 19:32
yarn.lock Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@santib santib requested a review from a team November 15, 2023 18:35
@blacksam07 blacksam07 merged commit 7b94bec into main Nov 17, 2023
6 checks passed
@blacksam07 blacksam07 deleted the add-swagger-ui branch November 17, 2023 15:18
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.

6 participants