From e3a6f6f63a6b0f57b7e26d6eb611ef8171a66fe2 Mon Sep 17 00:00:00 2001 From: Dinh Nguyen Date: Tue, 30 Jul 2024 12:57:53 +0700 Subject: [PATCH] provide example for schema --- .../axonivy/market/entity/MavenArtifactModel.java | 3 +++ .../axonivy/market/entity/ProductModuleContent.java | 10 ++++++++++ .../market/model/MavenArtifactVersionModel.java | 2 ++ .../com/axonivy/market/model/ProductDetailModel.java | 12 ++++++++++++ .../java/com/axonivy/market/model/ProductModel.java | 7 +++++++ 5 files changed, 34 insertions(+) diff --git a/marketplace-service/src/main/java/com/axonivy/market/entity/MavenArtifactModel.java b/marketplace-service/src/main/java/com/axonivy/market/entity/MavenArtifactModel.java index 81a27e864..e1bb99383 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/entity/MavenArtifactModel.java +++ b/marketplace-service/src/main/java/com/axonivy/market/entity/MavenArtifactModel.java @@ -1,5 +1,6 @@ package com.axonivy.market.entity; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -17,7 +18,9 @@ public class MavenArtifactModel implements Serializable { @Serial private static final long serialVersionUID = 1L; + @Schema(description = "Display name and type of artifact", example = "Adobe Acrobat Sign Connector (.iar)") private String name; + @Schema(description = "Artifact download url", example = "https://maven.axonivy.com/com/axonivy/connector/adobe/acrobat/sign/adobe-acrobat-sign-connector/10.0.25/adobe-acrobat-sign-connector-10.0.25.iar") private String downloadUrl; @Transient private Boolean isProductArtifact; diff --git a/marketplace-service/src/main/java/com/axonivy/market/entity/ProductModuleContent.java b/marketplace-service/src/main/java/com/axonivy/market/entity/ProductModuleContent.java index bc48a39ad..43397d99a 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/entity/ProductModuleContent.java +++ b/marketplace-service/src/main/java/com/axonivy/market/entity/ProductModuleContent.java @@ -1,5 +1,6 @@ package com.axonivy.market.entity; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -16,13 +17,22 @@ public class ProductModuleContent implements Serializable { @Serial private static final long serialVersionUID = 1L; + @Schema(description = "Target release tag", example = "v10.0.25") private String tag; + @Schema(description = "Product detail description content ", example = "{ \"de\": \"E-Sign-Konnektor\", \"en\": \"E-sign connector\" }") private Map description; + @Schema(description = "Setup tab content", example = "Adobe Sign account creation: An Adobe Sign account needs to be created to setup and use the connector.") private String setup; + @Schema(description = "Demo tab content", example = "The demo project can be used to test the authentication and signing and the demo implementation can be used as inspiration for development") private String demo; + @Schema(description = "Is dependency artifact", example = "true") private Boolean isDependency; + @Schema(example = "Adobe Acrobat Sign Connector") private String name; + @Schema(description = "Product artifact's group id", example = "com.axonivy.connector.adobe.acrobat.sign") private String groupId; + @Schema(description = "Product artifact's artifact id", example = "adobe-acrobat-sign-connector-product") private String artifactId; + @Schema(description = "Artifact file type", example = "iar") private String type; } diff --git a/marketplace-service/src/main/java/com/axonivy/market/model/MavenArtifactVersionModel.java b/marketplace-service/src/main/java/com/axonivy/market/model/MavenArtifactVersionModel.java index 4acdc23ad..32ef52dcd 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/model/MavenArtifactVersionModel.java +++ b/marketplace-service/src/main/java/com/axonivy/market/model/MavenArtifactVersionModel.java @@ -1,6 +1,7 @@ package com.axonivy.market.model; import com.axonivy.market.entity.MavenArtifactModel; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; @@ -13,6 +14,7 @@ @AllArgsConstructor @NoArgsConstructor public class MavenArtifactVersionModel { + @Schema(description = "Target version", example = "10.0.19") private String version; private List artifactsByVersion; } \ No newline at end of file diff --git a/marketplace-service/src/main/java/com/axonivy/market/model/ProductDetailModel.java b/marketplace-service/src/main/java/com/axonivy/market/model/ProductDetailModel.java index 99a13922f..bfe864dbd 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/model/ProductDetailModel.java +++ b/marketplace-service/src/main/java/com/axonivy/market/model/ProductDetailModel.java @@ -1,6 +1,7 @@ package com.axonivy.market.model; import com.axonivy.market.entity.ProductModuleContent; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -11,17 +12,28 @@ @Setter @NoArgsConstructor public class ProductDetailModel extends ProductModel { + @Schema(description = "Product vendor", example = "Axon Ivy AG") private String vendor; + @Schema(description = "Platform review", example = "4.5") private String platformReview; + @Schema(description = "Latest release version from maven", example = "v10.0.25") private String newestReleaseVersion; + @Schema(description = "Product cost", example = "Free") private String cost; + @Schema(description = "Source repository url", example = "https://github.com/axonivy-market/adobe-acrobat-sign-connector") private String sourceUrl; + @Schema(description = "Status badge url", example = "https://github.com/axonivy-market/adobe-acrobat-sign-connector/actions/workflows/ci.yml/badge.svg") private String statusBadgeUrl; + @Schema(description = "Default language", example = "English") private String language; + @Schema(description = "Product industry", example = "Cross-Industry") private String industry; + @Schema(description = "Compatibility", example = "10.0+") private String compatibility; + @Schema(description = "Can contact us", example = "false") private Boolean contactUs; private ProductModuleContent productModuleContent; + @Schema(description = "Installation/download count", example = "0") private int installationCount; @Override diff --git a/marketplace-service/src/main/java/com/axonivy/market/model/ProductModel.java b/marketplace-service/src/main/java/com/axonivy/market/model/ProductModel.java index 1eeb4f3bc..74fbe9471 100644 --- a/marketplace-service/src/main/java/com/axonivy/market/model/ProductModel.java +++ b/marketplace-service/src/main/java/com/axonivy/market/model/ProductModel.java @@ -2,6 +2,7 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -19,11 +20,17 @@ @Relation(collectionRelation = "products", itemRelation = "product") @JsonInclude(Include.NON_NULL) public class ProductModel extends RepresentationModel { + @Schema(description = "Product id", example = "jira-connector") private String id; + @Schema(description = "Product name by locale", example = "{ \"de\": \"Atlassian Jira\", \"en\": \"Atlassian Jira\" }") private Map names; + @Schema(description = "Product's short descriptions by locale", example = "{ \"de\": \"Nutze den Jira Connector von Atlassian, um Jira-Tickets direkt von der Axon Ivy Plattform aus zu verfolgen.\", \"en\": \"Atlassian's Jira connector lets you track issues directly from the Axon Ivy platform\" }") private Map shortDescriptions; + @Schema(description = "Product's logo url", example = "https://raw.githubusercontent.com/axonivy-market/market/feature/MARP-463-Multilingualism-for-Website/market/connector/jira/logo.png") private String logoUrl; + @Schema(description = "Type of product", example = "connector") private String type; + @Schema(description = "Tags of product", example = "[\"helper\"]") private List tags; @Override