Skip to content

Commit

Permalink
Add Swagger annotations to CommentResponse and UpdateComment
Browse files Browse the repository at this point in the history
Added Swagger annotations to fields in `CommentResponse` and `UpdateComment` for improved API documentation clarity. Annotations provide thorough descriptions and specify required fields, enhancing the maintainability and user comprehension of the API.

Signed-off-by: rooki <[email protected]>
  • Loading branch information
Pdzly committed Aug 14, 2024
1 parent 53dd65a commit 66d4ee9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,38 @@
package com.sublinks.sublinksapi.api.sublinks.v1.comment.models;

import com.sublinks.sublinksapi.api.sublinks.v1.person.models.PersonResponse;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.Schema.RequiredMode;
import java.util.List;
import lombok.Builder;

@Builder(toBuilder = true)
public record CommentResponse(
String key,
String activityPubId,
String body,
String path,
Boolean isLocal,
Boolean isDeleted,
Boolean isFeatured,
Boolean isRemoved,
String createdAt,
PersonResponse creator,
List<CommentResponse> replies,
String updatedAt) {
@Schema(description = "The key of the comment",
requiredMode = RequiredMode.REQUIRED) String key,
@Schema(description = "The activity pub id of the comment",
requiredMode = RequiredMode.REQUIRED) String activityPubId,
@Schema(description = "The body of the comment",
requiredMode = RequiredMode.REQUIRED) String body,
@Schema(description = "The path of the comment",
requiredMode = RequiredMode.REQUIRED) String path,
@Schema(description = "Is the comment local",
requiredMode = RequiredMode.REQUIRED) Boolean isLocal,
@Schema(description = "Is the comment deleted",
requiredMode = RequiredMode.REQUIRED) Boolean isDeleted,
@Schema(description = "Is the comment featured",
requiredMode = RequiredMode.REQUIRED) Boolean isFeatured,
@Schema(description = "Is the comment removed",
requiredMode = RequiredMode.REQUIRED) Boolean isRemoved,

@Schema(description = "The creator of the comment",
requiredMode = RequiredMode.REQUIRED) PersonResponse creator,
@Schema(description = "The parent of the comment",
requiredMode = RequiredMode.NOT_REQUIRED) List<CommentResponse> replies,
@Schema(description = "The created at date",
requiredMode = RequiredMode.REQUIRED) String createdAt,
@Schema(description = "The updated at date",
requiredMode = RequiredMode.REQUIRED) String updatedAt) {


public String getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

@Builder
public record UpdateComment(
String body,
@Schema(description = "The new content of the comment",
requiredMode = RequiredMode.REQUIRED) String body,
@Schema(description = "The language key of the comment",
defaultValue = "und",
example = "und",
requiredMode = RequiredMode.NOT_REQUIRED) String languageKey,
@Schema(description = "Whether the comment is featured ( Requires Moderator or Admin )",
defaultValue = "false",
example = "false",
requiredMode = RequiredMode.NOT_REQUIRED) Boolean featured) {

Expand Down

0 comments on commit 66d4ee9

Please sign in to comment.