Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn authored and raphael0202 committed Nov 23, 2023
1 parent 4f3eadc commit 1fa567e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ProductCreate(BaseModel):
min_length=1,
pattern="^[0-9]+$",
description="barcode (EAN) of the product, as a string.",
examples=["8001505005707"],
)


Expand All @@ -41,11 +42,19 @@ class ProductBase(ProductCreate):
description="source of data, either `off` (Open Food Facts), "
"`obf` (Open Beauty Facts), `opff` (Open Pet Food Facts) or `obf` (Open Beauty Facts)"
)
product_name: str | None = Field(description="name of the product.")
product_name: str | None = Field(
description="name of the product.", examples=["Nocciolata"]
)
product_quantity: int | None = Field(
description="quantity of the product, normalized in g or mL (depending on the product)."
description="quantity of the product, normalized in g or mL (depending on the product).",
examples=[700],
)
image_url: AnyHttpUrl | None = Field(
description="URL of the product image.",
examples=[
"https://images.openfoodfacts.org/images/products/800/150/500/5707/front_fr.161.400.jpg"
],
)
image_url: AnyHttpUrl | None = Field(description="URL of the product image.")
created: datetime.datetime = Field(description="datetime of the creation.")
updated: datetime.datetime | None = Field(
description="datetime of the last update."
Expand Down Expand Up @@ -79,7 +88,7 @@ class PriceCreate(BaseModel):
min_length=1,
pattern="^[0-9]+$",
description="barcode (EAN) of the product, as a string.",
examples=["16584958", "1234567890123"],
examples=["16584958", "8001505005707"],
)
category_tag: str | None = Field(
default=None,
Expand Down

0 comments on commit 1fa567e

Please sign in to comment.