diff options
| author | Pascal Getreuer <50221757+getreuer@users.noreply.github.com> | 2025-03-31 22:06:42 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-01 16:06:42 +1100 |
| commit | da166d4d8b1eb5cf984a08effdf20faaca2b3234 (patch) | |
| tree | 07d4bac5c1f532ff5d7432c5f3fd74f924e0dfbe | |
| parent | 3cd292498566cd94983a5311156fb3b7f348d911 (diff) | |
Add "license" field to Community Module JSON schema. (#25085)
Add "license" field to community module schema.
| -rw-r--r-- | data/schemas/community_module.jsonschema | 1 | ||||
| -rw-r--r-- | docs/features/community_modules.md | 5 | ||||
| -rwxr-xr-x | lib/python/qmk/json_encoders.py | 8 | ||||
| -rw-r--r-- | modules/qmk/hello_world/qmk_module.json | 1 | ||||
| -rw-r--r-- | modules/qmk/super_alt_tab/qmk_module.json | 1 |
5 files changed, 13 insertions, 3 deletions
diff --git a/data/schemas/community_module.jsonschema b/data/schemas/community_module.jsonschema index a3474476df..a237e210ce 100644 --- a/data/schemas/community_module.jsonschema +++ b/data/schemas/community_module.jsonschema | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | "properties": { | 7 | "properties": { |
| 8 | "module_name": {"$ref": "qmk.definitions.v1#/text_identifier"}, | 8 | "module_name": {"$ref": "qmk.definitions.v1#/text_identifier"}, |
| 9 | "maintainer": {"$ref": "qmk.definitions.v1#/text_identifier"}, | 9 | "maintainer": {"$ref": "qmk.definitions.v1#/text_identifier"}, |
| 10 | "license": {"type": "string"}, | ||
| 10 | "url": { | 11 | "url": { |
| 11 | "type": "string", | 12 | "type": "string", |
| 12 | "format": "uri" | 13 | "format": "uri" |
diff --git a/docs/features/community_modules.md b/docs/features/community_modules.md index a28c5afaeb..52526c9fe8 100644 --- a/docs/features/community_modules.md +++ b/docs/features/community_modules.md | |||
| @@ -72,6 +72,7 @@ A Community Module is denoted by a `qmk_module.json` file such as the following: | |||
| 72 | { | 72 | { |
| 73 | "module_name": "Hello World", | 73 | "module_name": "Hello World", |
| 74 | "maintainer": "QMK Maintainers", | 74 | "maintainer": "QMK Maintainers", |
| 75 | "license": "GPL-2.0-or-later", | ||
| 75 | "features": { | 76 | "features": { |
| 76 | "deferred_exec": true | 77 | "deferred_exec": true |
| 77 | }, | 78 | }, |
| @@ -86,6 +87,10 @@ A Community Module is denoted by a `qmk_module.json` file such as the following: | |||
| 86 | 87 | ||
| 87 | At minimum, the module must provide the `module_name` and `maintainer` fields. | 88 | At minimum, the module must provide the `module_name` and `maintainer` fields. |
| 88 | 89 | ||
| 90 | The `license` field is encouraged to indicate the terms for using and sharing the module. It is recommended to use a [SPDX license identifier](https://spdx.org/licenses/) like "`Apache-2.0`" or "`GPL-2.0-or-later`" if possible. | ||
| 91 | |||
| 92 | The `url` field may specify a URL to more information about the module. | ||
| 93 | |||
| 89 | The use of `features` matches the definition normally provided within `keyboard.json` and `info.json`, allowing a module to signal to the build system that it has its own dependencies. In the example above, it enables the _deferred executor_ feature whenever the above module is used in a build. | 94 | The use of `features` matches the definition normally provided within `keyboard.json` and `info.json`, allowing a module to signal to the build system that it has its own dependencies. In the example above, it enables the _deferred executor_ feature whenever the above module is used in a build. |
| 90 | 95 | ||
| 91 | The `keycodes` array allows a module to provide new keycodes (as well as corresponding aliases) to a keymap. | 96 | The `keycodes` array allows a module to provide new keycodes (as well as corresponding aliases) to a keymap. |
diff --git a/lib/python/qmk/json_encoders.py b/lib/python/qmk/json_encoders.py index e83a381d52..e8bcf48996 100755 --- a/lib/python/qmk/json_encoders.py +++ b/lib/python/qmk/json_encoders.py | |||
| @@ -250,12 +250,14 @@ class CommunityModuleJSONEncoder(QMKJSONEncoder): | |||
| 250 | return '00module_name' | 250 | return '00module_name' |
| 251 | if key == 'maintainer': | 251 | if key == 'maintainer': |
| 252 | return '01maintainer' | 252 | return '01maintainer' |
| 253 | if key == 'license': | ||
| 254 | return '02license' | ||
| 253 | if key == 'url': | 255 | if key == 'url': |
| 254 | return '02url' | 256 | return '03url' |
| 255 | if key == 'features': | 257 | if key == 'features': |
| 256 | return '03features' | 258 | return '04features' |
| 257 | if key == 'keycodes': | 259 | if key == 'keycodes': |
| 258 | return '04keycodes' | 260 | return '05keycodes' |
| 259 | elif self.indentation_level == 3: # keycodes | 261 | elif self.indentation_level == 3: # keycodes |
| 260 | if key == 'key': | 262 | if key == 'key': |
| 261 | return '00key' | 263 | return '00key' |
diff --git a/modules/qmk/hello_world/qmk_module.json b/modules/qmk/hello_world/qmk_module.json index fd855a6e23..bbd00f3fcc 100644 --- a/modules/qmk/hello_world/qmk_module.json +++ b/modules/qmk/hello_world/qmk_module.json | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | { | 1 | { |
| 2 | "module_name": "Hello World", | 2 | "module_name": "Hello World", |
| 3 | "maintainer": "QMK Maintainers", | 3 | "maintainer": "QMK Maintainers", |
| 4 | "license": "GPL-2.0-or-later", | ||
| 4 | "features": { | 5 | "features": { |
| 5 | "console": true, | 6 | "console": true, |
| 6 | "deferred_exec": true | 7 | "deferred_exec": true |
diff --git a/modules/qmk/super_alt_tab/qmk_module.json b/modules/qmk/super_alt_tab/qmk_module.json index 002f7fb69e..142613a23e 100644 --- a/modules/qmk/super_alt_tab/qmk_module.json +++ b/modules/qmk/super_alt_tab/qmk_module.json | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | { | 1 | { |
| 2 | "module_name": "Super Alt Tab", | 2 | "module_name": "Super Alt Tab", |
| 3 | "maintainer": "QMK Maintainers", | 3 | "maintainer": "QMK Maintainers", |
| 4 | "license": "GPL-2.0-or-later", | ||
| 4 | "keycodes": [ | 5 | "keycodes": [ |
| 5 | { | 6 | { |
| 6 | "key": "COMMUNITY_MODULE_SUPER_ALT_TAB", | 7 | "key": "COMMUNITY_MODULE_SUPER_ALT_TAB", |
