python-jsonschema / python-jsonschema/check-jsonschema
Support loading of GitLab `!reference` data during validation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 341
- Forks
- 71
- Avg merge
- 15d 20h
- Merged PRs (30d)
- 4
Description
Preface
GitLab !reference support was added in https://github.com/python-jsonschema/check-jsonschema/issues/112 but there are still some edge cases.
How I verified that there are no duplicate issues in the issue tracker
I searched for the "reference" word between open and closed issues and I found only closed https://github.com/python-jsonschema/check-jsonschema/issues/112.
.pre-commit-config.yaml
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.23.1
hooks:
- id: check-gitlab-ci
args: ["--data-transform", "gitlab-ci"]
Valid .gitlab-ci.yml
include:
- project: "myproject/mynamespace/backend/repositoryname"
ref: v1.1.22
file: ".gitlab-ci-common.yml"
test:
stage: test
services:
- name: mongo:6.0.6
command: ["/bin/sh", "-c", "mongod --logpath /dev/null --bind_ip_all --replSet 'rs0' "]
- !reference [.common_services_for_test_job, services]
before_script:
- echo "Hello"
check-gitlab-ci output
Validate GitLab CI config................................................
Failed
- hook id: check-gitlab-ci
- exit code: 1
Schema validation errors were encountered.
.gitlab-ci.yml::$.test.services[1]: ['.common_services_for_test_job', 'services'] is not valid under any of the given schemas
Underlying errors caused this.
Best Match:
$.test.services[1]: ['.common_services_for_test_job', 'services'] is not of type 'string'
Expected result
Accept the mentioned YAML syntax.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the failure with the check-gitlab-ci hook and --data-transform gitlab-ci against the YAML example in the issue. Trace the validation path for the services entry and determine how GitLab !reference values are represented during loading. Done means the shown syntax is accepted without the schema validation error and existing validation still passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, yaml
- Domain
- ci-cd, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100