📝 Update source examples to use new JSON Schema examples field (#9776)

* 📝 Update source examples to use new JSON Schema examples field

*  Update tests for JSON Schema examples

* 📝 Update highlights in JSON Schema examples
This commit is contained in:
Sebastián Ramírez
2023-07-01 18:43:29 +02:00
committed by GitHub
parent 983f1d34db
commit 4d83f984cc
11 changed files with 80 additions and 190 deletions

View File

@@ -23,29 +23,18 @@ async def update_item(
Body(
examples=[
{
"summary": "A normal example",
"description": "A **normal** item works correctly.",
"value": {
"name": "Foo",
"description": "A very nice Item",
"price": 35.4,
"tax": 3.2,
},
"name": "Foo",
"description": "A very nice Item",
"price": 35.4,
"tax": 3.2,
},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {
"name": "Bar",
"price": "35.4",
},
"name": "Bar",
"price": "35.4",
},
{
"summary": "Invalid data is rejected with an error",
"value": {
"name": "Baz",
"price": "thirty five point four",
},
"name": "Baz",
"price": "thirty five point four",
},
],
),