Uber, delivery start-up Postmates, and two contractors who work for the companies filed suit against the state of California on Monday, alleging that the recently passed Assembly Bill 5 is unconstitutional. The law, which is set to go into effect on Jan. 1, 2020, would require gig-economy workers to be reclassified as employees instead of contractors.

The case represents one of the biggest challenges yet to law that could limit the operations of on-demand services like ride sharing and food delivery.

"AB 5 is an irrational and unconstitutional statute designed to target and stifle workers and companies in the on-demand economy," wrote the companies, which filed the complaint alongside Uber driver Lydia Olson and Postmates delivery driver Miguel Perez.

The filing in the U.S. District Court for Central California, claimed that the law carves out "nonsensical" exemptions for roles such as "direct salespeople, travel agents, grant writers, construction truck drivers, commercial fisherman" and many more. It also alleged that a delivery truck driver delivering milk would not be affected, but one delivering juice would be.

Uber and competitor Lyft are among the companies that pledged hundreds of millions for a California ballot initiative to propose an alternative model. Lyft declined to comment.

"California represents 9% of our global Rides and Eats gross bookings, but a negligible amount of our Rides and Eats adjusted EBITDA, respectively," Uber CEO Dara Khosrowshahi told analysts on a conference call last month. "We continue to focus on a path that we believe provides a very attractive option for drivers and couriers where they retain flexibility, but gain important new protections like healthcare subsidies and minimum earning standards."

The law affects far more than gig-economy companies: Freelance writers and other types of contractors are also affected. Earlier this month CNBC reported that Vox Media planned to cut freelancers in California as a result of the passage of the bill.

Here's the lawsuit: