Add ApiModelProperty annotation to authorative models 65/84165/2
authorChenfei Gao <cgao@research.att.com>
Thu, 4 Apr 2019 01:37:23 +0000 (21:37 -0400)
committerChenfei Gao <cgao@research.att.com>
Thu, 4 Apr 2019 02:47:40 +0000 (22:47 -0400)
Add @ApiModelProperty to authorative models for the fields
that have different serialized names from their property names.

Issue-ID: POLICY-1515
Change-Id: Id6509afe5cc741a6253fc0d1f98ae6b22d31f0d9
Signed-off-by: Chenfei Gao <cgao@research.att.com>
models-tosca/pom.xml
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConstraint.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntity.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaProperty.java
models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaServiceTemplate.java
models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/concepts/LegacyGuardPolicyInput.java
models-tosca/src/main/java/org/onap/policy/models/tosca/legacy/concepts/LegacyOperationalPolicy.java

index c8fa252..5b857c1 100644 (file)
             <artifactId>mariadb-java-client</artifactId>
             <scope>test</scope>
         </dependency>
+        
+        <dependency>
+            <groupId>io.swagger</groupId>
+            <artifactId>swagger-jersey2-jaxrs</artifactId>
+        </dependency>
 
     </dependencies>
 </project>
index 4623b20..582b73c 100644 (file)
@@ -24,6 +24,7 @@
 package org.onap.policy.models.tosca.authorative.concepts;
 
 import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import java.util.List;
 import lombok.Data;
 
@@ -35,20 +36,25 @@ import lombok.Data;
 @Data
 public class ToscaConstraint {
 
+    @ApiModelProperty(name = "valid_values")
     @SerializedName("valid_values")
     private List<String> validValues;
 
     private String equal;
 
+    @ApiModelProperty(name = "greater_than")
     @SerializedName("greater_than")
     private String greaterThan;
 
+    @ApiModelProperty(name = "greater_or_equal")
     @SerializedName("greater_or_equal")
     private String greaterOrEqual;
 
+    @ApiModelProperty(name = "less_than")
     @SerializedName("less_than")
     private String lessThan;
 
+    @ApiModelProperty(name = "less_or_equal")
     @SerializedName("less_or_equal")
     private String lessOrEqual;
 
index a61f2a7..9d327a2 100644 (file)
 package org.onap.policy.models.tosca.authorative.concepts;
 
 import com.google.gson.annotations.SerializedName;
-
+import io.swagger.annotations.ApiModelProperty;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Map.Entry;
-
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NonNull;
-
 import org.onap.policy.models.base.PfNameVersion;
 
 /**
@@ -46,6 +44,7 @@ public class ToscaEntity implements PfNameVersion {
 
     private String version;
 
+    @ApiModelProperty(name = "derived_from")
     @SerializedName("derived_from")
     private String derivedFrom;
 
index 38c6859..6463abc 100644 (file)
@@ -26,7 +26,6 @@ package org.onap.policy.models.tosca.authorative.concepts;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Map.Entry;
-
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
index 84f798b..00005f2 100644 (file)
@@ -24,6 +24,7 @@
 package org.onap.policy.models.tosca.authorative.concepts;
 
 import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import java.util.List;
 import lombok.Data;
 
@@ -46,6 +47,7 @@ public class ToscaProperty {
 
     private String description;
 
+    @ApiModelProperty(name = "default")
     @SerializedName("default")
     private String defaultValue;
 
@@ -55,6 +57,7 @@ public class ToscaProperty {
 
     private List<ToscaConstraint> constraints;
 
+    @ApiModelProperty(name = "entry_schema")
     @SerializedName("entry_schema")
     private ToscaEntrySchema entrySchema;
 }
index a9a1783..0b19708 100644 (file)
@@ -24,6 +24,7 @@
 package org.onap.policy.models.tosca.authorative.concepts;
 
 import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
 import java.util.List;
 import java.util.Map;
 import lombok.Data;
@@ -38,15 +39,19 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class ToscaServiceTemplate extends ToscaEntity {
 
+    @ApiModelProperty(name = "tosca_definitions_version")
     @SerializedName("tosca_definitions_version")
     private String toscaDefinitionsVersion;
 
+    @ApiModelProperty(name = "topology_template")
     @SerializedName("topology_template")
     private ToscaTopologyTemplate toscaTopologyTemplate;
 
+    @ApiModelProperty(name = "policy_types")
     @SerializedName("policy_types")
     private List<Map<String, ToscaPolicyType>> policyTypes;
 
+    @ApiModelProperty(name = "data_types")
     @SerializedName("data_types")
     private List<Map<String, ToscaDataType>> dataTypes;
 }
\ No newline at end of file
index 18853c1..819fcba 100644 (file)
@@ -22,7 +22,7 @@
 package org.onap.policy.models.tosca.legacy.concepts;
 
 import com.google.gson.annotations.SerializedName;
-
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -33,9 +33,11 @@ import lombok.Data;
 @Data
 public class LegacyGuardPolicyInput {
 
+    @ApiModelProperty(name = "policy-id")
     @SerializedName("policy-id")
     private String policyId;
 
+    @ApiModelProperty(name = "policy-version")
     @SerializedName("policy-version")
     private String policyVersion;
 
index 1db4d6e..70453da 100644 (file)
@@ -22,7 +22,7 @@
 package org.onap.policy.models.tosca.legacy.concepts;
 
 import com.google.gson.annotations.SerializedName;
-
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -33,9 +33,11 @@ import lombok.Data;
 @Data
 public class LegacyOperationalPolicy {
 
+    @ApiModelProperty(name = "policy-id")
     @SerializedName("policy-id")
     private String policyId;
 
+    @ApiModelProperty(name = "policy-version")
     @SerializedName("policy-version")
     private String policyVersion;