It's one-way (with a hyphen), but there's nothing wrong with it grammatically. In terms of style, however, it has many more words than necessary, and the logic is a bit strange, given that you're talking about a one-way street. You could just have said, Walking against the traffic is safer than walking with the traffic.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.