private boolean validateOperationId(Operation operation,String urlPath,String operationType){
  if (Strings.isNullOrEmpty(operation.getOperationId())) {
    addDiag(Diag.error(createOperationLocation(operationType,urlPath),"Operation does not have the required 'operationId' field. Please specify unique" + " value for 'operationId' field for all operations."));
    return false;
  }
  String operationId=operation.getOperationId();
  String sanitizedOperationId=NameConverter.operationIdToMethodName(operationId);
  if (duplicateOperationIdLookup.containsKey(sanitizedOperationId)) {
    String dupeOperationId=duplicateOperationIdLookup.get(sanitizedOperationId);
    Location errorLocation=createOperationLocation(operationType,urlPath);
    String errorMessage=String.format("operationId '%s' has duplicate entry",operationId);
    if (!operationId.equals(dupeOperationId)) {
      errorLocation=SimpleLocation.TOPLEVEL;
      errorMessage+=String.format(". Duplicate operationId found is '%s'. The two operationIds result into same " + "underlying method name '%s'. Please use unique values for operationId",dupeOperationId,sanitizedOperationId);
    }
    addDiag(Diag.error(errorLocation,errorMessage));
    return false;
  }
  duplicateOperationIdLookup.put(sanitizedOperationId,operationId);
  return true;
}

private boolean validateOperationId ( Operation operation , String urlPath , String operationType ) { if ( Strings . isNullOrEmpty ( operation . getOperationId ( ) ) ) { addDiag ( Diag . error ( createOperationLocation ( operationType , urlPath ) , "Operation does not have the required 'operationId' field. Please specify unique" + " value for 'operationId' field for all operations." ) ) ; return false ; } String operationId = operation . getOperationId ( ) ; String sanitizedOperationId = NameConverter . operationIdToMethodName ( operationId ) ; if ( duplicateOperationIdLookup . containsKey ( sanitizedOperationId ) ) { String dupeOperationId = duplicateOperationIdLookup . get ( sanitizedOperationId ) ; Location errorLocation = createOperationLocation ( operationType , urlPath ) ; String errorMessage = String . format ( "operationId '%s' has duplicate entry" , operationId ) ; if ( ! operationId . equals ( dupeOperationId ) ) { errorLocation = SimpleLocation . TOPLEVEL ; errorMessage += String . format ( ". Duplicate operationId found is '%s'. The two operationIds result into same " + "underlying method name '%s'. Please use unique values for operationId" , dupeOperationId , sanitizedOperationId ) ; } addDiag ( Diag . error ( errorLocation , errorMessage ) ) ; return false ; } duplicateOperationIdLookup . put ( sanitizedOperationId , operationId ) ; return true ; }
validate if the operation id is correct and is unique .
