The court shall have jurisdiction to review the validity of the rule whether or not the petitioner has first requested the agency to pass upon the validity of the rule in question, but not when the petitioner is a party to an order or a contested case in which the validity of the rule may be determined by a court.