Skip to content

Commit

Permalink
Merge pull request #27
Browse files Browse the repository at this point in the history
add example values for the swagger spec
  • Loading branch information
hayco committed Mar 29, 2021
2 parents baf52c4 + b34e976 commit 3b626b2
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions textrepo-app/src/main/java/nl/knaw/huc/api/FormDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;

public class FormDocument {

@NotBlank(message = "is mandatory")
@ApiModelProperty(example = "document_1234")
private final String externalId;

@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.util.UUID;

public class FormTextRepoFile {

@NotNull(message = "is mandatory")
@ApiModelProperty(example = "34739357-eb75-449b-b2df-d3f6289470d6")
private UUID docId;

@NotNull(message = "is mandatory")
@ApiModelProperty(example = "1")
private Short typeId;

@JsonCreator
Expand Down
3 changes: 3 additions & 0 deletions textrepo-app/src/main/java/nl/knaw/huc/api/FormType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;

public class FormType {

@NotBlank(message = "is mandatory")
@ApiModelProperty(example = "plaintext")
private final String name;

@NotBlank(message = "is mandatory")
@ApiModelProperty(example = "text/plain")
private final String mimetype;

@JsonCreator
Expand Down
2 changes: 2 additions & 0 deletions textrepo-app/src/main/java/nl/knaw/huc/api/FormVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;

public class FormVersion {

@NotBlank(message = "is mandatory")
@ApiModelProperty(example = "document_1234")
private final String externalId;

@JsonCreator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import nl.knaw.huc.api.FormPageParams;
import nl.knaw.huc.api.ResultPage;
import nl.knaw.huc.api.ResultVersion;
import nl.knaw.huc.helpers.Paginator;
import nl.knaw.huc.service.version.VersionService;
Expand Down Expand Up @@ -48,7 +49,7 @@ public FileVersionsResource(
@Timed
@Produces(APPLICATION_JSON)
@ApiOperation("Retrieve file versions, newest first")
@ApiResponses({@ApiResponse(code = 200, response = ResultVersion.class, message = "OK")})
@ApiResponses({@ApiResponse(code = 200, response = ResultPage.class, message = "OK")})
public Response getFileVersions(
@PathParam("fileId") @Valid UUID fileId,
@BeanParam FormPageParams pageParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import nl.knaw.huc.api.ResultVersion;
import nl.knaw.huc.exceptions.MethodNotAllowedException;
import nl.knaw.huc.helpers.ContentsHelper;
import nl.knaw.huc.service.version.content.VersionContentsService;
Expand Down Expand Up @@ -58,7 +57,7 @@ public Response postVersionContentsIsNotAllowed() {
@Timed
@Produces(APPLICATION_JSON)
@ApiOperation(value = "Retrieve version contents")
@ApiResponses(value = {@ApiResponse(code = 200, response = ResultVersion.class, message = "OK")})
@ApiResponses(value = {@ApiResponse(code = 200, response = byte[].class, message = "OK")})
public Response getVersionContents(
@HeaderParam(ACCEPT_ENCODING) String acceptEncoding,
@PathParam("versionId") @NotNull @Valid UUID versionId
Expand Down

0 comments on commit 3b626b2

Please sign in to comment.