Home / File/ test_openapi_examples.py — fastapi Source File

test_openapi_examples.py — fastapi Source File

Architecture documentation for test_openapi_examples.py, a python file in the fastapi codebase. 5 imports, 0 dependents.

File python FastAPI Applications 5 imports 7 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  8ac1d492_09f7_2975_cc25_f70aecbbb54b["test_openapi_examples.py"]
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  8ac1d492_09f7_2975_cc25_f70aecbbb54b --> 0dda2280_3359_8460_301c_e98c77e78185
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  8ac1d492_09f7_2975_cc25_f70aecbbb54b --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  8ac1d492_09f7_2975_cc25_f70aecbbb54b --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  8ac1d492_09f7_2975_cc25_f70aecbbb54b --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  6913fbd4_39df_d14b_44bb_522e99b65b90["pydantic"]
  8ac1d492_09f7_2975_cc25_f70aecbbb54b --> 6913fbd4_39df_d14b_44bb_522e99b65b90
  style 8ac1d492_09f7_2975_cc25_f70aecbbb54b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import Union

from fastapi import Body, Cookie, FastAPI, Header, Path, Query
from fastapi.testclient import TestClient
from inline_snapshot import snapshot
from pydantic import BaseModel

app = FastAPI()


class Item(BaseModel):
    data: str


@app.post("/examples/")
def examples(
    item: Item = Body(
        examples=[
            {"data": "Data in Body examples, example1"},
        ],
        openapi_examples={
            "Example One": {
                "summary": "Example One Summary",
                "description": "Example One Description",
                "value": {"data": "Data in Body examples, example1"},
            },
            "Example Two": {
                "value": {"data": "Data in Body examples, example2"},
            },
        },
    ),
):
    return item


@app.get("/path_examples/{item_id}")
def path_examples(
    item_id: str = Path(
        examples=[
            "json_schema_item_1",
            "json_schema_item_2",
        ],
        openapi_examples={
            "Path One": {
                "summary": "Path One Summary",
                "description": "Path One Description",
                "value": "item_1",
            },
            "Path Two": {
                "value": "item_2",
            },
        },
    ),
):
    return item_id


@app.get("/query_examples/")
def query_examples(
    data: Union[str, None] = Query(
// ... (365 more lines)

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does test_openapi_examples.py do?
test_openapi_examples.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Applications subdomain.
What functions are defined in test_openapi_examples.py?
test_openapi_examples.py defines 7 function(s): cookie_examples, examples, header_examples, path_examples, query_examples, test_call_api, test_openapi_schema.
What does test_openapi_examples.py depend on?
test_openapi_examples.py imports 5 module(s): __init__.py, inline_snapshot, pydantic, testclient.py, typing.
Where is test_openapi_examples.py in the architecture?
test_openapi_examples.py is located at tests/test_openapi_examples.py (domain: FastAPI, subdomain: Applications, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free