Skip to content

Commit

Permalink
Adopt schemaver (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Jan 10, 2025
1 parent 31e9a8f commit 19f384f
Show file tree
Hide file tree
Showing 14 changed files with 2,554 additions and 983 deletions.
11 changes: 5 additions & 6 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@
"tasklist",
]
myst_linkify_fuzzy_links = False
default_config_payload = json.dumps(
json.loads(
(Path(__file__).parents[2] / "menuinst" / "data" / "menuinst.default.json").read_text()
),
indent=2,
)
latest_default = sorted(
(Path(__file__).parents[2] / "menuinst" / "data").glob("*-*.default.json"),
key=lambda path: [int(x) for x in path.name.split(".")[0].rsplit("-", 3)[-3:]],
)[-1]
default_config_payload = json.dumps(json.loads(latest_default.read_text()), indent=2)
myst_substitutions = {
"default_schema_json": f"```json\n{default_config_payload}\n```",
}
Expand Down
6 changes: 4 additions & 2 deletions menuinst/_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

log = getLogger(__name__)
SCHEMA_DIALECT = "http://json-schema.org/draft-07/schema#"
SCHEMA_VERSION = "1"
# We follow schemaver
SCHEMA_VERSION = "1-1-0"
SCHEMA_URL = f"https://schemas.conda.org/menuinst-{SCHEMA_VERSION}.schema.json"


Expand Down Expand Up @@ -702,6 +703,7 @@ class Config(BaseModel.Config):
schema_extra = {
"$schema": SCHEMA_DIALECT,
"$id": SCHEMA_URL,
"$version": SCHEMA_VERSION,
}

id_: constr(min_length=1) = Field(
Expand All @@ -712,7 +714,7 @@ class Config(BaseModel.Config):
)
schema_: constr(min_length=1) = Field(
SCHEMA_URL,
description="Version of the menuinst schema.",
description="Version of the menuinst schema to validate against.",
alias="$schema",
)
menu_name: constr(min_length=1) = Field(
Expand Down
66 changes: 66 additions & 0 deletions menuinst/data/menuinst-1-0-0.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"id_": "https://schemas.conda.io/menuinst-1.schema.json",
"schema_": "https://json-schema.org/draft-07/schema",
"menu_name": "REQUIRED",
"menu_items": [
{
"name": "REQUIRED",
"description": "REQUIRED",
"command": [
"REQUIRED"
],
"icon": null,
"precommand": null,
"precreate": null,
"working_dir": null,
"activate": true,
"terminal": false,
"platforms": {
"linux": {
"Categories": null,
"DBusActivatable": null,
"GenericName": null,
"Hidden": null,
"Implements": null,
"Keywords": null,
"MimeType": null,
"NoDisplay": null,
"NotShowIn": null,
"OnlyShowIn": null,
"PrefersNonDefaultGPU": null,
"StartupNotify": null,
"StartupWMClass": null,
"TryExec": null,
"glob_patterns": null
},
"osx": {
"CFBundleDisplayName": null,
"CFBundleIdentifier": null,
"CFBundleName": null,
"CFBundleSpokenName": null,
"CFBundleVersion": null,
"CFBundleURLTypes": null,
"CFBundleDocumentTypes": null,
"LSApplicationCategoryType": null,
"LSBackgroundOnly": null,
"LSEnvironment": null,
"LSMinimumSystemVersion": null,
"LSMultipleInstancesProhibited": null,
"LSRequiresNativeExecution": null,
"UTExportedTypeDeclarations": null,
"UTImportedTypeDeclarations": null,
"entitlements": null,
"link_in_bundle": null,
"event_handler": null
},
"win": {
"desktop": true,
"quicklaunch": true,
"url_protocols": null,
"file_extensions": null,
"app_user_model_id": null
}
}
}
]
}
Loading

0 comments on commit 19f384f

Please sign in to comment.