Flute Sonata in E-flat major, BWV 1031

The Sonata in E major for flute or recorder and harpsichord, probably by J. S. Bach (BWV 1031), is a sonata in 3 movements:
The Bach scholar Robert Marshall has argued that the sonata was composed by J. S. Bach, since it was attributed to him by two independent sources, Bach's son Carl Philipp Emanuel Bach in the manuscript copy of the work in his handwriting, and Christian Friedrich Penzel, Bach's last pupil.
The musicologist Jeanne Swack has suggested alternatively that BWV 1031 was "modelled" on a previous work for flute in E-flat by Johann Joachim Quantz (QV2:18 in the Augsbach catalog), which survives in a version for flute and obbligato harpsichord and in another version for flute, violin, and continuo. The similarities she cites are based primarily on structural and compositional considerations, as the musical themes are clearly different. However, Swack suggests either that Quantz composed both QV2:18 and BWV 1031, or that Bach (or another composer) used the Quantz original as a model for composing BWV 1031, which, she notes, is "much more complex and extensive.".