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

Evaluating swagger-ui part of application #18

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 83 additions & 22 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<version>2.1.8.RELEASE</version>
</parent>

<dependencies>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<groupId>org.springframework.security.oauth.boot</groupId>
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
<version>2.1.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -84,26 +85,10 @@
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- documentation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>2.8.0</version>
<groupId>org.webjars</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this? as we are manually downloading and unzip in unpack goal.

<artifactId>swagger-ui</artifactId>
<version>3.23.0</version>
</dependency>
</dependencies>

Expand Down Expand Up @@ -139,4 +124,80 @@
</plugins>
</build>

<profiles>
<profile>
<id> swagger-ui </id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<!-- Step 1. - Download Swagger UI webjar -->
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>swagger ui</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>3.23.0</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.directory}/swagger-ui</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- Step 2. Add Swagger-ui Resources to the WAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources combine.children = "append">
<resource>
<directory>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/3.23.0</directory>
<includes>
<include>**/*.*</include>
</includes>
<targetPath>swagger-ui</targetPath>
</resource>
</webResources>
</configuration>
</plugin>

<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.3</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/swagger-ui/META-INF/resources/webjars/swagger-ui/3.23.0/index.html</file>
<replacements>
<replacement>
<token>https://petstore.swagger.io/v2/swagger.json</token>
<value>http://ves-hx-e9.ebi.ac.uk:8080/dev/registry/property.yaml</value>
</replacement>
</replacements>
</configuration>
</plugin>

</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

@SpringBootApplication
public class PropertyRegistryServiceApplication extends SpringBootServletInitializer {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ public class EnableSecurityConfig extends ResourceServerConfigurerAdapter {

private static final String[] AUTH_WHITELIST = {
// -- swagger ui
"/v2/api-docs",
"/swagger-resources",
"/swagger-resources/**",
"/swagger-ui.html",
"/webjars/**",
"/swagger-ui/",
"/swagger-ui/**",
"/swagger-ui/index.html",
"/property.yaml",
"/"
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package uk.ac.ebi.ampt2d.registry.entities;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
Expand Down Expand Up @@ -55,36 +54,31 @@ public enum Type {
CONTINUOUS
}

@ApiModelProperty(position = 1, required = true)
@JsonProperty
@NotNull
@Size(min = 1, max = 255)
@Id
@Column(nullable = false, unique = true, updatable = false)
private String id;

@ApiModelProperty(position = 2, required = true)
@JsonProperty
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Group phenotypeGroup;

@ApiModelProperty(position = 3, required = true)
@NotNull
@NotBlank
@JsonProperty
@Column(nullable = false, columnDefinition = "TEXT")
private String description;

@ApiModelProperty(position = 4, required = true)
@JsonProperty
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Type type;

@ApiModelProperty(position = 5, required = true)
@JsonProperty
@NotNull
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package uk.ac.ebi.ampt2d.registry.entities;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
Expand Down Expand Up @@ -68,29 +67,25 @@ public enum Meaning {

}

@ApiModelProperty(position = 1)
@JsonProperty
@NotNull
@Size(min = 1, max = 255)
@Id
@Column(nullable = false, unique = true, updatable = false)
private String id;

@ApiModelProperty(position = 2)
@JsonProperty
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Type type;

@ApiModelProperty(position = 3)
@JsonProperty
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Meaning meaning;

@ApiModelProperty(position = 4)
@JsonProperty
@NotNull
@NotBlank
Expand Down
Loading