How can I validate GoCD configuration before applying it We have a GoCD installation where we like to keep the pipeline configuration XML files (cruise-config.xml) in a separate git repository, and install it (preferably via a pipeline and automatically) to the GoCD server whenever it is changed.

However we couldn't find an easy way to validate the XML config file before sending it off to GoCD, and obviously we do't want to install invalid configs, as that would break our pipelines. Are there any tools, or utilities that help us with validating the config file?
The best solution we found so far, is using the MagicalGoConfigXmlLoader  interface from the go source code, as it calls an internal validateCruiseConfig command, that does all validations, or die if the file is invalid:

MagicalGoConfigXmlLoader loader = new MagicalGoConfigXmlLoader(new ConfigCache());
loader.loadConfigHolder(configAsString);


The main problem with this solution that it essentially requires the whole GoCD server source code checked out, in a working state to work properly. Also as it's an internal API it is subject to changes between GoCD versions, making GoCD upgrades harder.