crystal-lang / shards

Dependency manager for the Crystal language
Other
766 stars 102 forks source link

Add JSON schema for `shard.yml` #623

Closed nobodywasishere closed 8 months ago

nobodywasishere commented 8 months ago

Implements #622. I can add automated tests if desired. After this, I can add it to JSON Schema Store.

I wasn't sure if we should restrict additional properties in the file, as there may be other tools that add stuff to the shard.yml. Off the top of my head, I can't remember any though, and they should probably move those kinds of things to their own config file.

Also if you're using VSCode, you can add this to the .vscode/settings.json and it will use the schema to vaidate the shard.yml that shards uses. I used this for testing.

// .vscode/settings.json
{
  "yaml.schemas": {
    "docs/shard.yml.schema.json": "shard.yml"
  }
}
nobodywasishere commented 8 months ago

Here are some examples of it with existing shard.ymls

Lucky:
Amber:
Mint:
Blurhash.cr:
nobodywasishere commented 8 months ago

Here are some of the errors it catches, alongside general format/form errors: image image image

It currently doesn't verify dependency version: tags, the crystal: version tag, or the github/gitlab/bitbucket user/repo format

nobodywasishere commented 8 months ago

Is there anything else that needs to be done for this?

nobodywasishere commented 8 months ago

SchemaStore/schemastore#3669