'Visual Studio Code showing error: Property Stages is not allowed, Property parameters is not allowed

I created reusable templates from Azure DevOps yaml pipeline. The build.yaml you see below is one such template.

When I push code, the pipeline successfully runs on Azure DevOps without complaining. However Visual Studio Code complains as I hover on parameters or stages.

Property Stages is not allowed 
Property parameters is not allowed

Am I missing any settings here? Why VS Code shows errors while azure devops runs the same successfully?

Property parameters is not allowed error shown by VS Code

Property stages is not allowed error shown by VS Code

And interestingly, I have another template in the same directory, which does not show any such error messages. What am I missing? I restarted vs code, still same.

VS Code showing no error with another yaml azure devops template



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source