Is it code-compliant to attach a patio to the roof like this?
What you have pictured is a typical hip detail. As long as you use proper sized lumber for the span and center dimensions it looks fine. The only thing I see is a lack of metal rafter hangers, bird's mouths and collar ties over the open span. Collar ties are not absolutely necessary if a cathedral design is wanted. basically, it looks OK.  Check your local codes in case they have special requirements in hurricane prone or heavy snow load areas.