@@ -1513,7 +1513,12 @@ public Link getLink(ObjectNode linkNode, String location, ParseResult result) {
1513
1513
} else {
1514
1514
link .set$ref (ref .textValue ());
1515
1515
}
1516
-
1516
+ if (result .isOpenapi31 ()) {
1517
+ String desc = getString ("description" , linkNode , false , location , result );
1518
+ if (StringUtils .isNotBlank (desc )) {
1519
+ link .setDescription (desc );
1520
+ }
1521
+ }
1517
1522
return link ;
1518
1523
} else {
1519
1524
result .invalidType (location , "$ref" , "string" , linkNode );
@@ -2088,6 +2093,12 @@ public Header getHeader(ObjectNode headerNode, String location, ParseResult resu
2088
2093
} else {
2089
2094
header .set$ref (ref .textValue ());
2090
2095
}
2096
+ if (result .isOpenapi31 ()) {
2097
+ String desc = getString ("description" , headerNode , false , location , result );
2098
+ if (StringUtils .isNotBlank (desc )) {
2099
+ header .setDescription (desc );
2100
+ }
2101
+ }
2091
2102
return header ;
2092
2103
} else {
2093
2104
result .invalidType (location , "$ref" , "string" , headerNode );
@@ -2162,6 +2173,7 @@ public Header getHeader(ObjectNode headerNode, String location, ParseResult resu
2162
2173
2163
2174
2164
2175
public Object getAnyExample (String nodeKey , ObjectNode node , String location , ParseResult result ) {
2176
+ //TODO: Examples now allows Ref
2165
2177
JsonNode example = node .get (nodeKey );
2166
2178
if (example != null ) {
2167
2179
if (example .getNodeType ().equals (JsonNodeType .STRING )) {
@@ -2246,6 +2258,12 @@ public SecurityScheme getSecurityScheme(ObjectNode node, String location, ParseR
2246
2258
} else {
2247
2259
securityScheme .set$ref (ref .textValue ());
2248
2260
}
2261
+ if (result .isOpenapi31 ()) {
2262
+ String desc = getString ("description" , node , false , location , result );
2263
+ if (StringUtils .isNotBlank (desc )) {
2264
+ securityScheme .setDescription (desc );
2265
+ }
2266
+ }
2249
2267
return securityScheme ;
2250
2268
} else {
2251
2269
result .invalidType (location , "$ref" , "string" , node );
@@ -3119,6 +3137,18 @@ public Example getExample(ObjectNode node, String location, ParseResult result)
3119
3137
} else {
3120
3138
example .set$ref (ref .textValue ());
3121
3139
}
3140
+ if (result .isOpenapi31 ()) {
3141
+ String desc = getString ("summary" , node , false , location , result );
3142
+ if (StringUtils .isNotBlank (desc )) {
3143
+ example .setSummary (desc );
3144
+ }
3145
+ }
3146
+ if (result .isOpenapi31 ()) {
3147
+ String desc = getString ("description" , node , false , location , result );
3148
+ if (StringUtils .isNotBlank (desc )) {
3149
+ example .setDescription (desc );
3150
+ }
3151
+ }
3122
3152
return example ;
3123
3153
} else {
3124
3154
result .invalidType (location , "$ref" , "string" , node );
@@ -3248,6 +3278,13 @@ public ApiResponse getResponse(ObjectNode node, String location, ParseResult res
3248
3278
} else {
3249
3279
apiResponse .set$ref (ref .textValue ());
3250
3280
}
3281
+ if (result .isOpenapi31 ()){
3282
+ String value = getString ("summary" , node , false , location , result );
3283
+ value = getString ("description" , node , false , location , result );
3284
+ if (StringUtils .isNotBlank (value )) {
3285
+ apiResponse .setDescription (value );
3286
+ }
3287
+ }
3251
3288
return apiResponse ;
3252
3289
} else {
3253
3290
result .invalidType (location , "$ref" , "string" , node );
@@ -3495,6 +3532,12 @@ public RequestBody getRequestBody(ObjectNode node, String location, ParseResult
3495
3532
} else {
3496
3533
body .set$ref (ref .textValue ());
3497
3534
}
3535
+ if (result .isOpenapi31 ()) {
3536
+ String desc = getString ("description" , node , false , location , result );
3537
+ if (StringUtils .isNotBlank (desc )) {
3538
+ body .setDescription (desc );
3539
+ }
3540
+ }
3498
3541
return body ;
3499
3542
} else {
3500
3543
result .invalidType (location , "$ref" , "string" , node );
0 commit comments