Skip to content

Commit

Permalink
EPMRPP-89261 || Migrate to springDoc (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
APiankouski authored Feb 20, 2024
1 parent c800793 commit 6a5e54d
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 41 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ wrapper {
}

dependencies {
compile "io.swagger:swagger-annotations:${swaggerAnnotationsVersion}"
compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
compile "javax.validation:validation-api:${validationApiVersion}"
compile "org.apache.commons:commons-lang3:${commonsLangVersion}"
compile group: 'com.google.guava', name: 'guava', version: '28.2-jre'
implementation "org.springdoc:springdoc-openapi-data-rest:${sprindocAnnotationsVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
implementation "javax.validation:validation-api:${validationApiVersion}"
implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation group: 'com.google.guava', name: 'guava', version: '28.2-jre'

// add lombok support
compileOnly "org.projectlombok:lombok:${lombokVersion}"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ hibernateValidatorVersion=6.1.2.Final
validationApiVersion=2.0.1.Final
junitVersion=4.12
elApiVersion=3.0.0
swaggerAnnotationsVersion=1.6.0
sprindocAnnotationsVersion=1.7.0
commonsLangVersion=3.9
mockitoJunitJupiter=2.23.0
jacksonVersion=2.10.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.Date;
import javax.validation.constraints.NotNull;

Expand All @@ -33,37 +34,37 @@ public class ActivityResource {

@NotNull
@JsonProperty(value = "id", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Long id;

@NotNull
@JsonProperty(value = "user", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private String user;

@NotNull
@JsonProperty(value = "loggedObjectId", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Long loggedObjectId;

@NotNull
@JsonProperty(value = "lastModified", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Date lastModified;

@NotNull
@JsonProperty(value = "actionType", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private String actionType;

@NotNull
@JsonProperty(value = "objectType", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private String objectType;

@NotNull
@JsonProperty(value = "projectId", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Long projectId;

@JsonProperty(value = "projectName")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
Expand All @@ -44,12 +45,12 @@ public class FinishExecutionRQ {
@NotNull
@JsonProperty(value = "endTime", required = true)
@JsonAlias({ "endTime", "end_time" })
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Date endTime;

@JsonProperty(value = "status")
@In(allowedValues = { "passed", "failed", "stopped", "skipped", "interrupted", "cancelled", "info", "warn" })
@ApiModelProperty(allowableValues = "PASSED, FAILED, STOPPED, SKIPPED, INTERRUPTED, CANCELLED, INFO, WARN")
@Schema(allowableValues = "PASSED, FAILED, STOPPED, SKIPPED, INTERRUPTED, CANCELLED, INFO, WARN")
private String status;

@JsonProperty(value = "description")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.Valid;

@JsonInclude(Include.NON_NULL)
Expand All @@ -35,7 +36,7 @@ public class FinishTestItemRQ extends FinishExecutionRQ {
private Boolean retry;

@JsonProperty(value = "launchUuid")
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private String launchUuid;

@JsonProperty(value = "testCaseId")
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/com/epam/ta/reportportal/ws/model/StartRQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
Expand All @@ -40,7 +41,7 @@
public class StartRQ {

@JsonProperty(value = "name", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
protected String name;

@JsonProperty(value = "description")
Expand All @@ -55,10 +56,10 @@ public class StartRQ {
@NotNull
@JsonProperty(required = true)
@JsonAlias({ "startTime", "start_time" })
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Date startTime;

@ApiModelProperty(hidden = true)
@Schema(hidden = true)
@JsonProperty(value = "uuid")
private String uuid;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
Expand Down Expand Up @@ -58,7 +58,7 @@ public class StartTestItemRQ extends StartRQ {

@NotNull
@JsonAlias({ "launchUuid", "launch_id" })
@ApiModelProperty(value = "UUID of parent launch", required = true)
@Schema(description = "UUID of parent launch", required = true)
private String launchUuid;

@NotNull
Expand All @@ -67,7 +67,7 @@ public class StartTestItemRQ extends StartRQ {
@JsonDeserialize(using = UpperCaseTypeDeserializer.class)
@In(allowedValues = { "suite", "story", "test", "scenario", "step", "before_class", "before_groups", "before_method", "before_suite",
"before_test", "after_class", "after_groups", "after_method", "after_suite", "after_test" })
@ApiModelProperty(required = true, allowableValues = "SUITE, STORY, TEST, SCENARIO, STEP, BEFORE_CLASS, BEFORE_GROUPS,"
@Schema(required = true, allowableValues = "SUITE, STORY, TEST, SCENARIO, STEP, BEFORE_CLASS, BEFORE_GROUPS,"
+ "BEFORE_METHOD, BEFORE_SUITE, BEFORE_TEST, AFTER_CLASS, AFTER_GROUPS, AFTER_METHOD, AFTER_SUITE, AFTER_TEST")
private String type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

package com.epam.ta.reportportal.ws.model.attribute;

import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;

/**
* @author <a href="mailto:[email protected]">Pavel Bortnik</a>
*/
public class ItemAttributesRQ extends ItemAttributeResource implements Serializable {

@ApiModelProperty(example = "false")
@Schema(example = "false")
private boolean system;

public ItemAttributesRQ() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;

import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotEmpty;

/**
* @author <a href="mailto:[email protected]">Ihar Kahadouski</a>
*/

@ApiModel
@Schema
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SamlResource extends AbstractAuthResource {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@JsonInclude(Include.NON_NULL)
public class StartLaunchRQ extends StartRQ {
Expand All @@ -34,7 +34,7 @@ public class StartLaunchRQ extends StartRQ {
private boolean rerun;

@JsonProperty("rerunOf")
@ApiModelProperty(value = "UUID of desired launch to rerun")
@Schema(description = "UUID of desired launch to rerun")
private String rerunOf;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import javax.validation.constraints.NotNull;
import java.util.Arrays;
import java.util.Date;
Expand All @@ -38,23 +39,23 @@ public class SaveLogRQ {
private String uuid;

@JsonAlias({ "itemUuid", "item_id" })
@ApiModelProperty(value = "UUID of test item owned this log")
@Schema(description = "UUID of test item owned this log")
private String itemUuid;

@JsonProperty(value = "launchUuid")
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private String launchUuid;

@NotNull
@JsonProperty(value = "time", required = true)
@ApiModelProperty(required = true)
@Schema(requiredMode = RequiredMode.REQUIRED)
private Date logTime;

@JsonProperty(value = "message")
private String message;

@JsonProperty(value = "level")
@ApiModelProperty(allowableValues = "error, warn, info, debug, trace, fatal, unknown")
@Schema(allowableValues = "error, warn, info, debug, trace, fatal, unknown")
private String level;

@JsonProperty(value = "file")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import com.epam.ta.reportportal.ws.annotations.In;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;

import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

Expand All @@ -31,6 +30,7 @@
* @author Pavel Bortnik
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@Schema
public class AnalyzerConfig {

@Min(value = MIN_SHOULD_MATCH)
Expand All @@ -52,11 +52,11 @@ public class AnalyzerConfig {

@JsonProperty(value = "analyzerMode")
@In(allowedValues = { "all", "launch_name", "current_launch", "previous_launch", "current_and_the_same_name" })
@ApiModelProperty(allowableValues = "ALL, LAUNCH_NAME, CURRENT_LAUNCH, PREVIOUS_LAUNCH, CURRENT_AND_THE_SAME_NAME")
@Schema(allowableValues = "ALL, LAUNCH_NAME, CURRENT_LAUNCH, PREVIOUS_LAUNCH, CURRENT_AND_THE_SAME_NAME")
private String analyzerMode;

@JsonProperty(value = "indexingRunning")
@ApiParam(hidden = true)
@Schema(hidden = true)
private boolean indexingRunning;

@JsonProperty(value = "allMessagesShouldMatch")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
Expand Down Expand Up @@ -56,10 +57,12 @@ public class OAuthRegistrationResource implements Serializable {

@Pattern(regexp = URL_PATTERN)
@JsonProperty(value = "authorizationUri")
@Schema(type = "string", pattern = URL_PATTERN, example = "string")
private String authorizationUri;

@Pattern(regexp = URL_PATTERN)
@JsonProperty(value = "tokenUri")
@Schema(type = "string", pattern = URL_PATTERN, example = "string")
private String tokenUri;

@JsonProperty(value = "userInfoEndpointUri")
Expand Down

0 comments on commit 6a5e54d

Please sign in to comment.