canonical / canonical/chisel

create JSON schema for slice definitions files

Open
#178 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
424
Forks
65
Avg merge
12d 19h
Merged PRs (30d)
1

Description

## Problem

The issue is depicted in #176. In short, we want to be able to validate new slice definitions that are being proposed, even though Chisel itself may ignore fields that are not part of the schema.

## Suggested approach

Instead of making Chisel print warnings for unknown fields, the preferred approach is to create a manageable JSON schema within this repo, that can be updated alongside the code and used as a reference from the SchemaStore.

Pros:
- the repo itself will be the source of truth and hold the explicit schema that Chisel expects within a Slice Definitions File
- with this JSON schema, our CI can do an early validation of new slice definitions without having to run Chisel
- adding this schema to the SchemaStore will allow contributors to have off-the-shelf validation within their IDEs

### Additional considerations

When validating a slice definition, we may need to consider
1. the `format` version
2. the chisel-release
3. the chisel version

We need to carefully think about this because adding new fields doesn't equate to bumping the `format`.

### Examples

Similar work has already been done for Rockcraft:
- Current JSON schema: https://github.com/canonical/rockcraft/blob/main/schema/rockcraft.json ([original PR](https://github.com/canonical/rockcraft/pull/455))
- Rockcraft schema in the SchemaStore: https://github.com/SchemaStore/schemastore/blob/054e754b8c7318916a221bdd230a2c8b520330ca/src/api/json/catalog.json#L4486-L4491
- Existing Chisel slices schema in the SchemaStore (manually maintained): https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/chisel-slices.json

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.