@@ -1153,27 +1153,32 @@ public ExternalDocumentation getExternalDocs(ObjectNode node, String location, P
1153
1153
1154
1154
public String getString (String key , ObjectNode node , boolean required , String location , ParseResult
1155
1155
result , Set <String > uniqueValues , boolean noInvalidError ) {
1156
- String value = null ;
1157
- JsonNode v = node .get (key );
1158
- if (node == null || v == null ) {
1159
- if (required ) {
1160
- result .missing (location , key );
1161
- result .invalid ();
1162
- }
1163
- } else if (!v .isValueNode ()) {
1164
- if (!noInvalidError ) {
1165
- result .invalidType (location , key , "string" , node );
1166
- }
1167
- } else if (!v .isNull ()) {
1168
- value = v .asText ();
1169
- if (uniqueValues != null && !uniqueValues .add (value )) {
1170
- result .unique (location , "operationId" );
1171
- result .invalid ();
1172
- }
1173
- }
1174
- return value ;
1156
+ return getString (key , node , required , location , result , uniqueValues , noInvalidError , false );
1175
1157
}
1176
1158
1159
+ public String getString (String key , ObjectNode node , boolean required , String location , ParseResult
1160
+ result , Set <String > uniqueValues , boolean noInvalidError , boolean missingForNullNode ) {
1161
+ String value = null ;
1162
+ JsonNode v = node .get (key );
1163
+ if (node == null || v == null || (v .isNull () && missingForNullNode )) {
1164
+ if (required ) {
1165
+ result .missing (location , key );
1166
+ result .invalid ();
1167
+ }
1168
+ } else if (!v .isValueNode ()) {
1169
+ if (!noInvalidError ) {
1170
+ result .invalidType (location , key , "string" , node );
1171
+ }
1172
+ } else if (!v .isNull ()) {
1173
+ value = v .asText ();
1174
+ if (uniqueValues != null && !uniqueValues .add (value )) {
1175
+ result .unique (location , "operationId" );
1176
+ result .invalid ();
1177
+ }
1178
+ }
1179
+ return value ;
1180
+ }
1181
+
1177
1182
public String getString (String key , ObjectNode node , boolean required , String location , ParseResult
1178
1183
result , Set <String > uniqueValues ) {
1179
1184
return getString (key , node , required , location , result , uniqueValues , false );
@@ -1289,7 +1294,7 @@ public Info getInfo(ObjectNode node, String location, ParseResult result) {
1289
1294
info .setLicense (license );
1290
1295
}
1291
1296
1292
- value = getString ("version" , node , true , location , result );
1297
+ value = getString ("version" , node , true , location , result , null , false , true );
1293
1298
if ((result .isAllowEmptyStrings () && value != null ) || (!result .isAllowEmptyStrings () && !StringUtils .isBlank (value ))) {
1294
1299
info .setVersion (value );
1295
1300
}
0 commit comments