python-jsonschema / python-jsonschema/check-jsonschema

Validate usage of double quotes in expressions

Open
#151 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement upstream-schema-issue
Dominant language
Python
Stars
341
Forks
71
Avg merge
15d 20h
Merged PRs (30d)
4

Description

Motivation

We use check-jsonschema in https://github.com/Lightning-AI/lightning/ to validate all our workflow files and it works very well. We have a GitHub action for this check here.

Recently we debugged an issue in our configuration that wasn't caught by check-jsonschema. The following yaml had double quotes in the expression:

    - name: Testing Warnings
      # the stacklevel can only be set on >=3.7
      if: ${{ (steps.skip.outputs.continue == '1') && ( matrix.python-version != "3.7" ) }}
      working-directory: tests/tests_pytorch
      # needs to run outside of `pytest`
      run: python utilities/test_warnings.py

which caused an error in the workflow:


The workflow is not valid. .github/workflows/ci-pytorch-test-full.yml (Line: 167, Col: 11): Unexpected symbol: '"3'. Located at position 68 within expression: (steps.skip.outputs.continue == '1') && ( matrix.python-version != "3.7" )

And it should have used single quotes like this:

matrix.python-version != '3.7'

check-jsonschema is useful for us because we can raise these warnings directly to the author in the PR.

Pitch

Would it be possible to have check-jsonschema validate against correct usage of single quotes vs. double quotes? I am not familiar with how check-jsonschema works, whether this is technically possible, or whether this is in the scope of this tool at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Start by locating check-jsonschema’s GitHub Actions workflow validation entry point and reviewing how expressions are currently handled; done means the reported double-quote usage is detected and surfaced as a warning or validation error.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, cli, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.