@@ -1153,27 +1153,32 @@ public ExternalDocumentation getExternalDocs(ObjectNode node, String location, P
11531153
11541154 public String getString (String key , ObjectNode node , boolean required , String location , ParseResult
11551155 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 );
11751157 }
11761158
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+
11771182 public String getString (String key , ObjectNode node , boolean required , String location , ParseResult
11781183 result , Set <String > uniqueValues ) {
11791184 return getString (key , node , required , location , result , uniqueValues , false );
@@ -1289,7 +1294,7 @@ public Info getInfo(ObjectNode node, String location, ParseResult result) {
12891294 info .setLicense (license );
12901295 }
12911296
1292- value = getString ("version" , node , true , location , result );
1297+ value = getString ("version" , node , true , location , result , null , false , true );
12931298 if ((result .isAllowEmptyStrings () && value != null ) || (!result .isAllowEmptyStrings () && !StringUtils .isBlank (value ))) {
12941299 info .setVersion (value );
12951300 }
0 commit comments