Skip to content

Commit

Permalink
add channel_base_urls
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Aug 13, 2024
1 parent e8431af commit 36659b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
10 changes: 8 additions & 2 deletions schema/model.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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):
Expand Down
13 changes: 12 additions & 1 deletion schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 36659b0

Please sign in to comment.