CircleCI Ideas

Maintain the JSON schema for config.yml

There is an unofficial JSON schema that can be used to validate config.yml files, except it's out-of-date.  For example, it doesn't support the "executors" property and fails to validate jobs that specify an executor.

https://discuss.circleci.com/t/intellisense-for-circleci-yaml-in-visual-studio-code/18634

https://github.com/SchemaStore/schemastore

It would be nice if CircleCI either published their own schema or submitted patches to the schema on schemastore.

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Mar 12 2019
  • Taking votes
  • Attach files
  • Admin
    Nathan Dintenfass commented
    12 Mar 20:55

    We have looked at open-sourcing the official schema. One complication is that our configuration validation is a combination of schema-level checking and additional semantic analysis done in code. Right now your best bet is to use the CLI to run `circleci config validate`, which hits our servers to run validation of the configuration against our full sweep. It doesn't catch all runtime errors that may be in your logic, but it should tell you if the configuration itself is shaped correctly and will pass through our pipeline processing machinery to our execution system.

  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    13 Mar 01:56

    Thank you for your response.  I think I can clarify my needs a little better.

    The schema's primary role, at least for me, is not validation.  It's tooling.  Tab-completion and tooltip documentation are very helpful when dealing with a format that I don't often write.  The goal is not necessarily to catch mistakes; rather to help the author write their intended configuration more efficiently.

    For example, a minor annoyance today is that I'm seeing false-positive validation errors.  The schema doesn't understand the new `executor` property on jobs, so it's complaining about a missing `docker` property on the job object.

    Ideally, the schema would accept all valid Circle configs, providing helpful tooling, and with an understanding that validation may still fail on your servers.