
io.paradoxical.dropwizard.swagger.bundles.SwaggerUIBundle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dropwizard-swagger Show documentation
Show all versions of dropwizard-swagger Show documentation
Swagger managment on the admin resource for dropwizard
The newest version!
package io.paradoxical.dropwizard.swagger.bundles;
import io.dropwizard.setup.Environment;
import io.paradoxical.dropwizard.bundles.assets.AssetsDefinition;
import io.paradoxical.dropwizard.bundles.assets.AssetsDefinitionBundle;
import io.paradoxical.dropwizard.swagger.SwaggerAssets;
import io.paradoxical.dropwizard.swagger.SwaggerConfiguration;
import io.paradoxical.dropwizard.swagger.SwaggerUIConfigurator;
import lombok.NonNull;
import javax.annotation.Nonnull;
import java.util.function.Function;
public class SwaggerUIBundle extends AssetsDefinitionBundle {
private final SwaggerUIConfigurator swaggerUIConfigurator;
public SwaggerUIBundle(@NonNull final SwaggerUIConfigurator swaggerUIConfigurator) {
this(SwaggerAssets.Assets, swaggerUIConfigurator);
}
public SwaggerUIBundle(@NonNull final AssetsDefinition assets, @NonNull final SwaggerUIConfigurator swaggerUIConfigurator) {
super(assets);
this.swaggerUIConfigurator = swaggerUIConfigurator;
}
//
// Simplified common constructors
//
public SwaggerUIBundle(@NonNull @Nonnull final SwaggerConfiguration swaggerConfiguration) {
this(SwaggerAssets.Assets, new SwaggerUIConfigurator(swaggerConfiguration));
}
public SwaggerUIBundle(@NonNull @Nonnull final Function envConfigFunction) {
this(SwaggerAssets.Assets, new SwaggerUIConfigurator(envConfigFunction));
}
@Override
public void run(final Environment environment) {
super.run(environment);
swaggerUIConfigurator.configure(environment, environment.jersey());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy