Skip to content

feat(schema): add json schema

Adam Moss requested to merge adam-moss/gitlab-triage:feat/schema into master

What does this MR do and why?

This is the start of a json schema for the triage policy yaml file, as suggested in #295. I am submitting this in draft form for:

  1. early visibility by the project team
  2. early feedback from anyone so inclined
  3. for anyone wishing to test it, or who knows json schema better than I, to contribute 😇

Describe in detail what your merge request does and why.

This adds a schema folder with a gitlab-triage.json file. This file should validate triage policy files, with some limitations:

  1. as it is not current available on schema store you will need to configure it as a source, for example in Visual Studio Code you can add the following to the top of the relevant .yaml file:
# %YAML 1.2
# yaml-language-server: $schema=https://gitlab.com/adam-moss/gitlab-triage/-/raw/feat/schema/schema/gitlab-triage.json
# ---
resource_rules:
  ...
  1. A rule block is currently not enforcing being entirely unique. This doesn't affect anything per se, but is a sensible piece of validation to include.

  2. Validation for Conditions does not, as yet, filter by resource. In other words conditions like source_branch and target_branch will be accepted against epics, issues and branches rather than just merge_requests

  3. Abritatray yaml anchors aren't allowed

  4. yaml anchors aren't validated to be a condition, limit, or action (do we want too )

  5. Validation for Actions is a work in progress.

  6. Validation for Summaries does allows all actions.

This is my first foray into creating a json schema. I'm aware it isn't entirely DRY currently, that will be worked on as I continue reading the spec! If anyone more knowledgable has some pointers feel free to share them 👍

Edited by Adam Moss

Merge request reports