-
-
Save shawnwall/6d0ae5f4a5b3e18d8403507616a3efb2 to your computer and use it in GitHub Desktop.
Example of pydantic model field going from optional to explicit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional | |
from pydantic import BaseModel | |
class QuestionBase(BaseModel): | |
# optional, aka nullable | |
account_refid: Optional[int] | |
class QuestionCreate(QuestionBase): | |
# required | |
account_refid: int | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment