Extend sidewall hot water tank vent outside?
I do not know of any code that would be breaking. Check with the installation instructions for the water heater to make sure that you do not exceed the maximum length for the discharge piping.