Skip to content

Commit

Permalink
chore: configure new swagger version for roman in dropwizard4 (WPB-58…
Browse files Browse the repository at this point in the history
…16) (#133)

* chore: configure new swagger version for roman

* chore: configure new swagger version for roman
  • Loading branch information
yamilmedina committed Dec 8, 2023
1 parent 8b3419e commit b623ef5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-servlets</artifactId>
</dependency>
<dependency>
<groupId>com.smoketurner</groupId>
<artifactId>dropwizard-swagger</artifactId>
<version>4.0.0-1</version>
</dependency>
<!-- MIGRATION TO JAKARTA JETTY 11 -->
<dependency>
<groupId>jakarta.annotation</groupId>
Expand Down
8 changes: 8 additions & 0 deletions backend/src/main/java/com/wire/bots/roman/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.core.setup.Bootstrap;
import io.dropwizard.core.setup.Environment;
import io.federecio.dropwizard.swagger.SwaggerBundle;
import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration;
import io.jsonwebtoken.security.Keys;
import jakarta.servlet.DispatcherType;
import jakarta.servlet.FilterRegistration;
Expand Down Expand Up @@ -72,6 +74,12 @@ public void initialize(Bootstrap<Config> bootstrap) {
bootstrap.addBundle(new WebsocketBundle(WebSocket.class));
bootstrap.addCommand(new UpdateCertCommand());
bootstrap.addBundle(new AssetsBundle("/frontend", "/", "index.html"));
bootstrap.addBundle(new SwaggerBundle<>() {
@Override
protected SwaggerBundleConfiguration getSwaggerBundleConfiguration(Config configuration) {
return configuration.swaggerBundleConfiguration;
}
});
}

@Override
Expand Down
4 changes: 4 additions & 0 deletions backend/src/main/java/com/wire/bots/roman/model/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wire.lithium.Configuration;
import io.dropwizard.validation.ValidationMethod;
import io.federecio.dropwizard.swagger.SwaggerBundleConfiguration;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;

Expand All @@ -42,6 +43,9 @@ public class Config extends Configuration {
@JsonProperty
public String romanPubKeyBase64;

@JsonProperty("swagger")
public SwaggerBundleConfiguration swaggerBundleConfiguration;

@ValidationMethod(message = "`romanPubKeyBase64` is not in a valid base64 format")
@JsonIgnore
public boolean pubKeyFormatIsNotValid() {
Expand Down

0 comments on commit b623ef5

Please sign in to comment.