mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-06-27 16:10:30 +08:00
fix: indicate that user is optional
This commit is contained in:
committed by
Andreas Köpf
parent
036c4b6c6c
commit
904f442f5a
@@ -5,7 +5,7 @@ from typing import Literal, Optional, Union
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
import pydantic
|
||||
from pydantic import BaseModel
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class TaskRequestType(str, enum.Enum):
|
||||
@@ -56,7 +56,9 @@ class TaskRequest(BaseModel):
|
||||
"""The frontend asks the backend for a task."""
|
||||
|
||||
type: TaskRequestType = TaskRequestType.random
|
||||
user: Optional[User] = None
|
||||
# Must use Field(..., nullable=True) to indicate to the OpenAPI schema that
|
||||
# this is optional. https://github.com/pydantic/pydantic/issues/1270
|
||||
user: Optional[User] = Field(None, nullable=True)
|
||||
collective: bool = False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user