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

Swagger UI additional middleware #636

Closed
wants to merge 2 commits into from
Closed

Conversation

jpage-godaddy
Copy link
Contributor

Summary

  • Add lifecycles for additional swagger UI handling
  • Remove unnecessary express dependency
  • Split swagger plugin code into separate modules
  • Export interface for Swagger config so it can be extended

Sometimes we need the ability to make Swagger UIs publicly inaccessible, but currently there's no easy way to add middleware that will intercept requests to the swagger UI routes so authentication can be injected.

Support thread for context.

Changelog

Included

Test Plan

Added unit tests. Did some sandbox local testing to ensure that @godaddy/gasket-preset-api worked with the new lifecycle. I couldn't get the Swagger plugin to work with fastify, so it may be broken, but if someone has an example setup that works I'll be happy to test there as well.

- Add lifecycles for additional  swagger UI handling
- Remove unnecessary express dependency
- Split swagger plugin code into separate modules
- Export interface for Swagger config so it can be extended
@jpage-godaddy jpage-godaddy requested a review from a team as a code owner November 22, 2023 18:46
Copy link

package-lock.json changes

Click to toggle table visibility
Name Status Previous Current
@types/express UPDATED 4.17.17 4.17.21

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No changes here; just split into a separate file because index.js was getting a bit long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No changes here; just split into a separate file because index.js was getting a bit long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No changes here; just split into a separate file because index.js was getting a bit long.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No changes here; just split into a separate file because index.js was getting a bit long.

"@types/swagger-ui-express": "^4.1.3",
"express": "^4.16.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is never imported.

"swagger-jsdoc": "^4.0.0",
"swagger-ui-express": "^4.1.4"
},
"devDependencies": {
"@gasket/engine": "^6.43.0",
"@gasket/plugin-log": "^6.43.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this because I changed the express and fastify hook tests to be more integration-y (using an actual Gasket plugin engine).

@mmason2-godaddy
Copy link
Contributor

@jpage-godaddy Is this PR still relevant? Seems it got missed over time. Would like me to update it and approve?

@jpage-godaddy
Copy link
Contributor Author

I think @agerard-godaddy was opposed to this idea. Slack thread for context. If you all agree you can close, but I'd be happy to keep it otherwise.

@mmason2-godaddy
Copy link
Contributor

Closed with ticket to explore solutions for this.

@agerard-godaddy agerard-godaddy deleted the swagger-ui-middleware branch September 16, 2024 20:58
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.

3 participants