Skip to content

Access to Swagger and Modify Swagger UI API Key#56

Open
nmonterroso wants to merge 9 commits intofederecio:masterfrom
Wikia:master
Open

Access to Swagger and Modify Swagger UI API Key#56
nmonterroso wants to merge 9 commits intofederecio:masterfrom
Wikia:master

Conversation

@nmonterroso
Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown
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.

3 participants