mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Complete type annotations for API endpoints.
This commit is contained in:
1 parent
cefab8d362
commit
9404c00411
35 files changed
+730
-414
No files matched your search
@@ -54,7 +54,13 @@ class ComputeCreate(ComputeBase):
|
||||
|
||||
class Config:
|
||||
schema_extra = {
|
||||
"example": {"name": "My compute", "host": "127.0.0.1", "port": 3080, "user": "user", "password": "password"}
|
||||
"example": {
|
||||
"name": "My compute",
|
||||
"host": "127.0.0.1",
|
||||
"port": 3080,
|
||||
"user": "user",
|
||||
"password": "password"
|
||||
}
|
||||
}
|
||||
|
||||
@validator("name", always=True)
|
||||
|
||||
@@ -30,7 +30,7 @@ class LinkNode(BaseModel):
|
||||
node_id: UUID
|
||||
adapter_number: int
|
||||
port_number: int
|
||||
label: Optional[Label]
|
||||
label: Optional[Label] = None
|
||||
|
||||
|
||||
class LinkType(str, Enum):
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from typing import Optional
|
||||
from pydantic import EmailStr, BaseModel, Field
|
||||
from pydantic import EmailStr, BaseModel, Field, SecretStr
|
||||
from uuid import UUID
|
||||
|
||||
from .base import DateTimeModelMixin
|
||||
@@ -37,7 +37,7 @@ class UserCreate(UserBase):
|
||||
"""
|
||||
|
||||
username: str = Field(..., min_length=3, regex="[a-zA-Z0-9_-]+$")
|
||||
password: str = Field(..., min_length=7, max_length=100)
|
||||
password: SecretStr = Field(..., min_length=7, max_length=100)
|
||||
|
||||
|
||||
class UserUpdate(UserBase):
|
||||
@@ -45,7 +45,7 @@ class UserUpdate(UserBase):
|
||||
Properties to update an user.
|
||||
"""
|
||||
|
||||
password: Optional[str] = Field(None, min_length=7, max_length=100)
|
||||
password: Optional[SecretStr] = Field(None, min_length=7, max_length=100)
|
||||
|
||||
|
||||
class User(DateTimeModelMixin, UserBase):
|
||||
|
||||
Reference in new issue
Block a user