How to hook up a new gas range with mismatched fittings, and meet all code requirements?
I normally install the shutoff directly on the incoming gas line this way there is less chance of an issue.
after the valve I install a flair adapter to match my flex gas tube . I prefer gas rated pipe dope for gas but there is a gas rated (yellow tape) for those that prefer tapes.

I rarely order fittings on line and tend to use speciality shops not big box as they always have the correct fitting I need and many times helpful advice , yes the part might cost a dollar or 2 more but I get the correct parts that match the first time and don’t end up with a bunch of adapters or cobbled together parts. 

The bonus about specialty stores is that they usually do know local codes and this project may be a good reason to give them a visit, I am not sure about the flair fitting prior to the valve that would bother me. I have done a bunch of gas pipe work on my own homes including new gas services in several,  but am an electrician by trade.