Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with JSON Schema + add schema linting to CI #1476

Merged
merged 4 commits into from
Jan 19, 2024

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Jan 18, 2024

Resolves #1474.
I've gone ahead and included a CI change to start running check-jsonschema against the schema in the docs dir, as mentioned in that issue, since it was part of how I validated this change.

I've tried to chunk the commits for easy review:

  • Remove "versioning" from jsonschema 'definitions' (remove the "3")
  • Dedent JSON Schema 'definitions' (git diff hates this one)
  • Fix malformed defer definition in JSON Schema ("string" -> {"type": "string"})
  • Add a linting step for the JSON Schema (.github/workflows/lint.yaml)

Aside:

I've been a little bit biased in check-jsonschema towards developers with workflows like my own and haven't thought hard enough about use-cases like this repo. I'll be thinking harder about providing docker containers to run the tool, perhaps some experimental binary builds (there are tools for this like pyinstaller) and maybe a GitHub Action too.

One thing which GitHub Actions has, which I would really like to be able to offer, is the integration with Dependabot to help you stay up to date as the tool evolves. So that's another angle on this.

I can't promise anything yet, but I'd like to make installing and using it easier for non-Python projects.

@andreynering
Copy link
Member

@sirosen I believe the CI failed because it missed the checkout step.

@sirosen
Copy link
Contributor Author

sirosen commented Jan 19, 2024

🤦 I feel silly for missing that; good catch! I've just pushed the added step as a fresh commit. I could squash it with the previous one if you have strong feelings about the git history and would like me to do so.

@andreynering
Copy link
Member

@sirosen Don't worry! A small mistake.

It'd be nice to have that commit squashed, if you don't mind. Also, adopting conventional commits for the commit messages would be great.

This removes the "3" nested in `definitions` which makes the contents
of `definitions` pass JSON Schema metaschema validation even when the
contents are not valid subschemas. `definitions` SHOULD contain
subschemas as its values, with no intermediate keys. (This is a MUST
in later JSON Schema spec versions, in which the key switches from
`definitions` to `$defs` as a related change.)

The contents are intentionally *not* dedented to make review easier.
The default git diff algorithm isn't great at showing this because
it incorrectly matches some closing blocks against other, distant,
closing blocks. But this is all just a two-space dedent.
The `defer` definition listed `"string"` where `{"type":"string"}`
was wanted.
This is written to use `check-jsonschema` on the (current) latest
version (0.27.3).

It checks that the JSON Schema published in the docs is valid
under its declared metaschema (`$schema`).
@sirosen
Copy link
Contributor Author

sirosen commented Jan 19, 2024

I just did a rebase to conventional-commits-ize the branch + squash those two commits. 👍

@andreynering andreynering added the area: json schema Changes related to the JSON schema. label Jan 19, 2024
@andreynering
Copy link
Member

Awesome, thanks @sirosen!

@andreynering andreynering merged commit b377dde into go-task:main Jan 19, 2024
12 checks passed
andreynering added a commit that referenced this pull request Jan 19, 2024
@sirosen sirosen deleted the jsonschema-improvements branch January 19, 2024 21:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: json schema Changes related to the JSON schema.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Schema for defer_call contains invalid JSON Schema, causing some schema validators to fail
2 participants