📝 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 authored and GitHub committed 2023-07-01 18:43:29 +02:00
1 parent 983f1d34db
commit 4d83f984cc
11 files changed
+80 -190

No files matched your search

@@ -46,26 +46,15 @@ def test_openapi_schema():
"title": "Item",
"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,
},
{"name": "Bar", "price": "35.4"},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {"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",
},
],
}
@@ -46,26 +46,15 @@ def test_openapi_schema():
"title": "Item",
"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,
},
{"name": "Bar", "price": "35.4"},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {"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",
},
],
}
@@ -55,26 +55,15 @@ def test_openapi_schema(client: TestClient):
"title": "Item",
"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,
},
{"name": "Bar", "price": "35.4"},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {"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",
},
],
}
@@ -55,26 +55,15 @@ def test_openapi_schema(client: TestClient):
"title": "Item",
"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,
},
{"name": "Bar", "price": "35.4"},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {"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",
},
],
}
@@ -55,26 +55,15 @@ def test_openapi_schema(client: TestClient):
"title": "Item",
"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,
},
{"name": "Bar", "price": "35.4"},
{
"summary": "An example with converted data",
"description": "FastAPI can convert price `strings` to actual `numbers` automatically",
"value": {"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",
},
],
}