Source:
public APIDefinitionValidationResponse validateAPIDefinition(String apiDefinition, boolean returnJsonContent) throws APIManagementException { APIDefinitionValidationResponse validationResponse = new APIDefinitionValidationResponse(); OpenAPIV3Parser openAPIV3Parser = new OpenAPIV3Parser(); SwaggerParseResult parseAttemptForV3 = openAPIV3Parser.readContents(apiDefinition, null, null); if (CollectionUtils.isNotEmpty(parseAttemptForV3.getMessages())) { validationResponse.setValid(false); for (String message : parseAttemptForV3.getMessages()) { OASParserUtil.addErrorToValidationResponse(validationResponse, message); if (message.contains(APIConstants.OPENAPI_IS_MISSING_MSG)) { ErrorItem errorItem = new ErrorItem(); errorItem.setErrorCode(ExceptionCodes.INVALID_OAS3_FOUND.getErrorCode()); errorItem.setMessage(ExceptionCodes.INVALID_OAS3_FOUND.getErrorMessage()); errorItem.setDescription(ExceptionCodes.INVALID_OAS3_FOUND.getErrorMessage()); validationResponse.getErrorItems().add(errorItem); } } } else { OpenAPI openAPI = parseAttemptForV3.getOpenAPI(); io.swagger.v3.oas.models.info.Info info = openAPI.getInfo(); OASParserUtil.updateValidationResponseAsSuccess(validationResponse, apiDefinition, openAPI.getOpenapi(), info.getTitle(), info.getVersion(), null, info.getDescription(), openAPI.getServers().get(0).getUrl()); validationResponse.setParser(this); if (returnJsonContent) { if (!apiDefinition.trim().startsWith("{")) { JsonNode jsonNode = DeserializationUtils.readYamlTree(apiDefinition); validationResponse.setJsonContent(jsonNode.toString()); } else { validationResponse.setJsonContent(apiDefinition); } } } return validationResponse; }

Target:
public APIDefinitionValidationResponse validateAPIDefinition(String apiDefinition, boolean returnJsonContent) throws APIManagementException { APIDefinitionValidationResponse validationResponse = new APIDefinitionValidationResponse(); OpenAPIV3Parser openAPIV3Parser = new OpenAPIV3Parser(); SwaggerParseResult parseAttemptForV3 = openAPIV3Parser.readContents(apiDefinition, null, null); if (CollectionUtils.isNotEmpty(parseAttemptForV3.getMessages())) { validationResponse.setValid(false); for (String message : parseAttemptForV3.getMessages()) { OASParserUtil.addErrorToValidationResponse(validationResponse, message); if (message.contains(APIConstants.OPENAPI_IS_MISSING_MSG)) { ErrorItem errorItem = new ErrorItem(); errorItem.setErrorCode(ExceptionCodes.INVALID_OAS3_FOUND.getErrorCode()); errorItem.setMessage(ExceptionCodes.INVALID_OAS3_FOUND.getErrorMessage()); errorItem.setDescription(ExceptionCodes.INVALID_OAS3_FOUND.getErrorMessage()); validationResponse.getErrorItems().add(errorItem); } } } else { OpenAPI openAPI = parseAttemptForV3.getOpenAPI(); io.swagger.v3.oas.models.info.Info info = openAPI.getInfo(); OASParserUtil.updateValidationResponseAsSuccess( validationResponse, apiDefinition, openAPI.getOpenapi(), info.getTitle(), info.getVersion(), null, info.getDescription(), (openAPI.getServers()==null || openAPI.getServers().isEmpty() ) ? null : openAPI.getServers().stream().map(url -> url.getUrl()).collect(Collectors.toList()) ); validationResponse.setParser(this); if (returnJsonContent) { if (!apiDefinition.trim().startsWith("{")) { JsonNode jsonNode = DeserializationUtils.readYamlTree(apiDefinition); validationResponse.setJsonContent(jsonNode.toString()); } else { validationResponse.setJsonContent(apiDefinition); } } } return validationResponse; }