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

CLI: Validate JSON keymap input #16261

Merged
merged 7 commits into from
Feb 28, 2022
Merged

Conversation

Erovia
Copy link
Member

@Erovia Erovia commented Feb 7, 2022

Description

The flash, compile and json2c subcommands accept user-provided JSON keymaps.
Instead of accepting them as is, use the already existing schema and its validator to check if the provided file is

  1. a JSON file
  2. a Configurator-compatible JSON keymap

I've also added test cases, but I'm not particularly happy with them. However a more "proper" testing would need additional refactoring and I wanted to keep the scope of this change limited.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

It should use the passed schema.
The 'compile', 'flash' and 'json2c' subcommands were reworked to add
JSON keymap validation so error is reported for non-JSON and
non-compliant-JSON inputs.
@github-actions github-actions bot added cli qmk cli command python labels Feb 7, 2022
@Erovia Erovia requested review from a team February 7, 2022 14:36
@Erovia Erovia mentioned this pull request Feb 27, 2022
14 tasks
@Erovia Erovia requested a review from zvecr February 28, 2022 09:18
@zvecr zvecr merged commit fbfd531 into qmk:master Feb 28, 2022
@Erovia Erovia deleted the cli/json_keymap_validation branch March 2, 2022 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli qmk cli command python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants