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

Access to Swagger and Modify Swagger UI API Key #56

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

nmonterroso
Copy link

There currently isn't a way to access the Swagger object and add any additional documentation your application might need, like securityDefinition or tags (see #55). This PR introduces a new function to SwaggerBundle:

protected void setUpSwagger(Swagger swagger)

Which allows us to provide these properties, and then sets the application context's swagger attribute to this modified Swagger object, so it can be properly fetched in ApiListingResource.

Also introducing a SwaggerUIConfiguration class to configure some parts of the Swagger UI on /swagger. For now, the only controllable parts are the API key's name, it's location (header or query) and the name for the header or query param. This is configured like so:

# other configs
swaggerConfiguration:
  ui:
    authName: "api_key"
    authKey: "x-some-header"
    authKeyLocation: "header"

And default to api_key, api_key, query, which is their current value in the Swagger UI.

nmonterroso added 3 commits June 5, 2015 11:06
…d new protected void setUpSwagger(Swagger swagger) that allows users of dropwizard-swagger to modify the Swagger object, and then add it to the application's context so it can be used in ApiListingResource. This should allow us to add security definitions, tags, etc.
…aggerView. Currently supported is the ability to modify the default api key and where it goes (header, query) in requests, as well as the name of the header or query param
@apetersson
Copy link

This is something i would really use since i am using swagger with basic auth and it seems to leave out some important tags

@nmonterroso
Copy link
Author

@apetersson It looks like the main repo hasn't been updated since this pull request was opened. Currently we're importing this into our projects from an internal Archiva repository, but maybe we should release it to Maven Central if there are other folks who want to take advantage of this functionality. Though as much as possible we'd like to avoid forking. @federecio ?

akraxx pushed a commit to akraxx/dropwizard-swagger that referenced this pull request Jan 30, 2017
* Added the posibility to configure the contextRoot

* Fixed license header

* Compute SwaggerAssetsPath depending on contextRootPrefix

* Updated swagger version and disabled hanging test

* Enabled DefaultServerWithAuthenticationSeleniumTest

* Add ViewBundle diamond reference type

* Clean unused import
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