Skip to content

Commit

Permalink
Fix pydantic syntax for optional field
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Oct 7, 2024
1 parent 248f155 commit 8d23db2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions images/dashboard/src/schemas/boxes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pydantic import BaseModel, Field, validator
from typing import Optional
from typing_extensions import Annotated
from datetime import datetime
import re

Expand All @@ -23,12 +24,13 @@ class BoxBase(BaseModel):
description="Box's description",
example="My new osm sandbox",
)
seed_data_file_url: Optional[str] = Field(
seed_data_file_url: Optional[Annotated[str, Field(
...,
title="Seed data file URL",
description="(Optional) An absolute public URL to a PBF file or bzipped OSM XML file to seed the database with upon startup.",
example="https://example.com/template.pbf",
)
default=None
)]]

@validator("name")
def validate_name(cls, value):
Expand Down

0 comments on commit 8d23db2

Please sign in to comment.