Derivation (first integral of Euler-Lagrange when f does not depend on y)
The Euler-Lagrange equation gives $$ \begin{align*} \dd{x}\left(\pdfd{f}{y'}\right) - \pdfd{f}{y} = 0 \end{align*} $$ but $\partial f/\partial y = 0$ since $f$ does not depend on $y$, so integrating gives $$ \begin{align*} \pdfd{f}{y'} = \text{const.} \end{align*} $$