|
8 | 8 | import java.util.List; |
9 | 9 | import java.util.Map; |
10 | 10 |
|
| 11 | +import com.fasterxml.jackson.databind.node.*; |
11 | 12 | import org.slf4j.Logger; |
12 | 13 | import org.slf4j.LoggerFactory; |
13 | 14 | import com.fasterxml.jackson.core.JsonParser; |
14 | 15 | import com.fasterxml.jackson.core.JsonProcessingException; |
15 | 16 | import com.fasterxml.jackson.databind.DeserializationContext; |
16 | 17 | import com.fasterxml.jackson.databind.JsonDeserializer; |
17 | 18 | import com.fasterxml.jackson.databind.JsonNode; |
18 | | -import com.fasterxml.jackson.databind.node.ArrayNode; |
19 | | -import com.fasterxml.jackson.databind.node.DoubleNode; |
20 | | -import com.fasterxml.jackson.databind.node.FloatNode; |
21 | | -import com.fasterxml.jackson.databind.node.IntNode; |
22 | | -import com.fasterxml.jackson.databind.node.LongNode; |
23 | | -import com.fasterxml.jackson.databind.node.NumericNode; |
24 | | -import com.fasterxml.jackson.databind.node.ObjectNode; |
25 | | -import com.fasterxml.jackson.databind.node.TextNode; |
26 | 19 | import io.swagger.models.Xml; |
27 | 20 | import io.swagger.models.properties.ArrayProperty; |
28 | 21 | import io.swagger.models.properties.MapProperty; |
@@ -142,9 +135,9 @@ public Xml getXml(JsonNode node) { |
142 | 135 | Property propertyFromNode(JsonNode node) { |
143 | 136 | final String type = getString(node, PropertyBuilder.PropertyId.TYPE); |
144 | 137 | final String format = getString(node, PropertyBuilder.PropertyId.FORMAT); |
145 | | - final String description = getString(node, PropertyBuilder.PropertyId.DESCRIPTION); |
146 | 138 | final Xml xml = getXml(node); |
147 | 139 |
|
| 140 | + String description = getString(node, PropertyBuilder.PropertyId.DESCRIPTION); |
148 | 141 | JsonNode detailNode = node.get("$ref"); |
149 | 142 | if (detailNode != null) { |
150 | 143 | return new RefProperty(detailNode.asText()).description(description); |
@@ -174,20 +167,23 @@ Property propertyFromNode(JsonNode node) { |
174 | 167 | if("type".equals(field.getKey()) && field.getValue() != null && "array".equals(field.getValue().asText())) { |
175 | 168 | detailNodeType = "array"; |
176 | 169 | } |
| 170 | + if(("description").equals(field.getKey()) && field.getValue().getNodeType().equals(JsonNodeType.STRING)) { |
| 171 | + description = field.getValue().asText(); |
| 172 | + } |
177 | 173 | } |
178 | 174 | } |
179 | 175 | } |
180 | 176 |
|
181 | 177 | if("array".equals(detailNodeType)) { |
182 | | - ArrayProperty ap = new ArrayProperty(); |
| 178 | + ArrayProperty ap = new ArrayProperty().description(description); |
183 | 179 | ap.setDescription(description); |
184 | 180 |
|
185 | 181 | if(properties.keySet().size() == 1) { |
186 | 182 | String key = properties.keySet().iterator().next(); |
187 | 183 | ap.setItems(properties.get(key)); |
188 | 184 | } |
189 | 185 | ap.setVendorExtensionMap(getVendorExtensions(node)); |
190 | | - return ap.description(description); |
| 186 | + return ap; |
191 | 187 | } |
192 | 188 | ObjectProperty objectProperty = new ObjectProperty(properties).description(description); |
193 | 189 | objectProperty.setVendorExtensionMap(getVendorExtensions(node)); |
|
0 commit comments