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.

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

  • Guest
  • Mar 12 2019
  • Taking votes
  • Attach files
  • Guest commented
    13 Mar, 2019 01:56am

    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.

  • Nathan Dintenfass commented
    12 Mar, 2019 08:55pm

    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.

  • and 3 more