Взгляните на образец магазина домашних животных из тега 1.3.12, который был последней версией выпуска Swagger 1.2 - https://github.com/swagger-api/swagger-core/tree/v1.3.12/samples/java-jaxrs.
В частности, вам нужно добавить определения к чему-то, как ваш Bootstrap класс:
public class Bootstrap extends HttpServlet {
static {
// do any additional initialization here, such as set your base path programmatically as such:
// ConfigFactory.config().setBasePath("http://www.foo.com/");
ApiInfo info = new ApiInfo(
"Swagger Sample App", /* title */
"This is a sample server Petstore server. You can find out more about Swagger " +
"at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, " +
"you can use the api key \"special-key\" to test the authorization filters",
"http://helloreverb.com/terms/", /* TOS URL */
"[email protected]", /* Contact */
"Apache 2.0", /* license */
"http://www.apache.org/licenses/LICENSE-2.0.html" /* license URL */
);
List<AuthorizationScope> scopes = new ArrayList<AuthorizationScope>();
scopes.add(new AuthorizationScope("email", "Access to your email address"));
scopes.add(new AuthorizationScope("pets", "Access to your pets"));
List<GrantType> grantTypes = new ArrayList<GrantType>();
ImplicitGrant implicitGrant = new ImplicitGrant(
new LoginEndpoint("http://petstore.swagger.wordnik.com/oauth/dialog"),
"access_code");
grantTypes.add(implicitGrant);
AuthorizationType oauth = new OAuthBuilder().scopes(scopes).grantTypes(grantTypes).build();
ConfigFactory.config().addAuthorization(oauth);
ConfigFactory.config().setApiInfo(info);
}
}
Моя развязность версия 1.2 –
При использовании Swagger Spec 1.2 является обязательным, то, пожалуйста, обратитесь к [Authorization Objects] (https://github.com/swagger-api/swagger-spec/blob/master/versions/1.2.md#514-authorizations-object) в спецификации. –