From 36659b08cc50341a01a47d31538908fdc9bf7553 Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Tue, 13 Aug 2024 13:59:31 +0200 Subject: [PATCH] add channel_base_urls --- schema/model.py | 10 ++++++++-- schema/schema.json | 13 ++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/schema/model.py b/schema/model.py index 68cce43..ce36306 100644 --- a/schema/model.py +++ b/schema/model.py @@ -1,20 +1,25 @@ from __future__ import annotations import json -from typing import List, Union +from typing import Annotated, List, Union from pydantic import ( BaseModel, Field, TypeAdapter, DirectoryPath, + UrlConstraints, constr, NonNegativeInt, + AnyHttpUrl ) +from pydantic_core import Url NonEmptyStr = constr(min_length=1) Platform = NonEmptyStr +CondaUrl = Annotated[Url, UrlConstraints(allowed_schemes=['http', 'https', 'file'])] + # TODO: Add regex maybe? PackageName = NonEmptyStr Version = NonEmptyStr @@ -36,7 +41,7 @@ class FrontendCapabilities(BaseModel): class InitializeParams(BaseModel): """ - The params send as part of the `initialize` rpc method. The expected result is of type `InitializeResult`. + The params send as part of the `initialize` rpc method. The expected result is of type `InitializeResult`. """ source_dir: DirectoryPath = Field( @@ -67,6 +72,7 @@ class CondaMetadataParams(BaseModel): None, description="The target platform, or the current platform if not specified", ) + channel_base_urls: List[CondaUrl] = Field(None, description="Urls of channels to use for any resolution.") class CondaPackageMetadata(BaseModel): diff --git a/schema/schema.json b/schema/schema.json index 7a86d35..605f883 100644 --- a/schema/schema.json +++ b/schema/schema.json @@ -34,6 +34,17 @@ "default": null, "description": "The target platform, or the current platform if not specified", "title": "Target Platform" + }, + "channels": { + "default": null, + "description": "Urls of channels to use for any resolution.", + "items": { + "format": "uri", + "minLength": 1, + "type": "string" + }, + "title": "Channels", + "type": "array" } }, "title": "CondaMetadataParams", @@ -166,7 +177,7 @@ "type": "object" }, "InitializeParams": { - "description": "The params send as part of the `initialize` rpc method. The expected result is of type `InitializeResult`.", + "description": "The params send as part of the `initialize` rpc method. The expected result is of type `InitializeResult`.", "properties": { "source_dir": { "description": "An absolute path to the directory that contains the source files",