diff --git a/docs/img/tutorial/fastapi/multiple-models/image03.png b/docs/img/tutorial/fastapi/multiple-models/image03.png index f3830b8..796ca5a 100644 Binary files a/docs/img/tutorial/fastapi/multiple-models/image03.png and b/docs/img/tutorial/fastapi/multiple-models/image03.png differ diff --git a/docs/tutorial/fastapi/multiple-models.md b/docs/tutorial/fastapi/multiple-models.md index c4db7c6..41c1ac6 100644 --- a/docs/tutorial/fastapi/multiple-models.md +++ b/docs/tutorial/fastapi/multiple-models.md @@ -98,7 +98,7 @@ But we also want to have a `HeroCreate` for the data we want to receive when **c * `secret_name`, required * `age`, optional -And we want to have a `HeroRead` with the `id` field, but this time annotated with `id: int`, instead of `id: Optional[int]`, to make it clear that it is required in responses **read** from the clients: +And we want to have a `HeroPublic` with the `id` field, but this time annotated with `id: int`, instead of `id: Optional[int]`, to make it clear that it is required in responses **read** from the clients: * `id`, required * `name`, required @@ -183,9 +183,9 @@ Here's the important detail, and probably the most important feature of **SQLMod This means that the class `Hero` represents a **table** in the database. It is both a **Pydantic** model and a **SQLAlchemy** model. -But `HeroCreate` and `HeroRead` don't have `table = True`. They are only **data models**, they are only **Pydantic** models. They won't be used with the database, but only to declare data schemas for the API (or for other uses). +But `HeroCreate` and `HeroPublic` don't have `table = True`. They are only **data models**, they are only **Pydantic** models. They won't be used with the database, but only to declare data schemas for the API (or for other uses). -This also means that `SQLModel.metadata.create_all()` won't create tables in the database for `HeroCreate` and `HeroRead`, because they don't have `table = True`, which is exactly what we want. 🚀 +This also means that `SQLModel.metadata.create_all()` won't create tables in the database for `HeroCreate` and `HeroPublic`, because they don't have `table = True`, which is exactly what we want. 🚀 /// tip @@ -355,7 +355,7 @@ Then we just `add` it to the **session**, `commit`, and `refresh` it, and finall Because it is just refreshed, it has the `id` field set with a new ID taken from the database. -And now that we return it, FastAPI will validate the data with the `response_model`, which is a `HeroRead`: +And now that we return it, FastAPI will validate the data with the `response_model`, which is a `HeroPublic`: //// tab | Python 3.10+ @@ -743,9 +743,9 @@ As an alternative, we could use `HeroBase` directly in the API code instead of ` On top of that, we could easily decide in the future that we want to receive **more data** when creating a new hero apart from the data in `HeroBase` (for example, a password), and now we already have the class to put those extra fields. -### The `HeroRead` **Data Model** +### The `HeroPublic` **Data Model** -Now let's check the `HeroRead` model. +Now let's check the `HeroPublic` model. This one just declares that the `id` field is required when reading a hero from the API, because a hero read from the API will come from the database, and in the database it will always have an ID. @@ -815,7 +815,7 @@ This one just declares that the `id` field is required when reading a hero from ## Review the Updated Docs UI -The FastAPI code is still the same as above, we still use `Hero`, `HeroCreate`, and `HeroRead`. But now, we define them in a smarter way with inheritance. +The FastAPI code is still the same as above, we still use `Hero`, `HeroCreate`, and `HeroPublic`. But now, we define them in a smarter way with inheritance. So, we can jump to the docs UI right away and see how they look with the updated data. diff --git a/docs/tutorial/fastapi/read-one.md b/docs/tutorial/fastapi/read-one.md index becb2c6..0976961 100644 --- a/docs/tutorial/fastapi/read-one.md +++ b/docs/tutorial/fastapi/read-one.md @@ -164,7 +164,7 @@ This will let the client know that they probably made a mistake on their side an Then, if the hero exists, we return it. -And because we are using the `response_model` with `HeroRead`, it will be validated, documented, etc. +And because we are using the `response_model` with `HeroPublic`, it will be validated, documented, etc. //// tab | Python 3.10+ diff --git a/docs/tutorial/fastapi/relationships.md b/docs/tutorial/fastapi/relationships.md index e2a2678..4087dfc 100644 --- a/docs/tutorial/fastapi/relationships.md +++ b/docs/tutorial/fastapi/relationships.md @@ -40,9 +40,9 @@ Let's update that. 🤓 First, why is it that we are not getting the related data for each hero and for each team? -It's because we declared the `HeroRead` with only the same base fields of the `HeroBase` plus the `id`. But it doesn't include a field `team` for the **relationship attribute**. +It's because we declared the `HeroPublic` with only the same base fields of the `HeroBase` plus the `id`. But it doesn't include a field `team` for the **relationship attribute**. -And the same way, we declared the `TeamRead` with only the same base fields of the `TeamBase` plus the `id`. But it doesn't include a field `heroes` for the **relationship attribute**. +And the same way, we declared the `TeamPublic` with only the same base fields of the `TeamBase` plus the `id`. But it doesn't include a field `heroes` for the **relationship attribute**. //// tab | Python 3.10+ @@ -146,7 +146,7 @@ And the same way, we declared the `TeamRead` with only the same base fields of t Now, remember that FastAPI uses the `response_model` to validate and **filter** the response data? -In this case, we used `response_model=TeamRead` and `response_model=HeroRead`, so FastAPI will use them to filter the response data, even if we return a **table model** that includes **relationship attributes**: +In this case, we used `response_model=TeamPublic` and `response_model=HeroPublic`, so FastAPI will use them to filter the response data, even if we return a **table model** that includes **relationship attributes**: //// tab | Python 3.10+ @@ -300,7 +300,7 @@ Let's add a couple more **data models** that declare that data so we can use the ## Models with Relationships -Let's add the models `HeroReadWithTeam` and `TeamReadWithHeroes`. +Let's add the models `HeroPublicWithTeam` and `TeamPublicWithHeroes`. We'll add them **after** the other models so that we can easily reference the previous models. @@ -372,11 +372,11 @@ These two models are very **simple in code**, but there's a lot happening here. ### Inheritance and Type Annotations -The `HeroReadWithTeam` **inherits** from `HeroRead`, which means that it will have the **normal fields for reading**, including the required `id` that was declared in `HeroRead`. +The `HeroPublicWithTeam` **inherits** from `HeroPublic`, which means that it will have the **normal fields for reading**, including the required `id` that was declared in `HeroPublic`. -And then it adds the **new field** `team`, which could be `None`, and is declared with the type `TeamRead` with the base fields for reading a team. +And then it adds the **new field** `team`, which could be `None`, and is declared with the type `TeamPublic` with the base fields for reading a team. -Then we do the same for the `TeamReadWithHeroes`, it **inherits** from `TeamRead`, and declares the **new field** `heroes`, which is a list of `HeroRead`. +Then we do the same for the `TeamPublicWithHeroes`, it **inherits** from `TeamPublic`, and declares the **new field** `heroes`, which is a list of `HeroPublic`. ### Data Models Without Relationship Attributes @@ -386,11 +386,11 @@ Instead, here these are only **data models** that will tell FastAPI **which attr ### Reference to Other Models -Also, notice that the field `team` is not declared with this new `TeamReadWithHeroes`, because that would again create that infinite recursion of data. Instead, we declare it with the normal `TeamRead` model. +Also, notice that the field `team` is not declared with this new `TeamPublicWithHeroes`, because that would again create that infinite recursion of data. Instead, we declare it with the normal `TeamPublic` model. -And the same for `TeamReadWithHeroes`, the model used for the new field `heroes` uses `HeroRead` to get only each hero's data. +And the same for `TeamPublicWithHeroes`, the model used for the new field `heroes` uses `HeroPublic` to get only each hero's data. -This also means that, even though we have these two new models, **we still need the previous ones**, `HeroRead` and `TeamRead`, because we need to reference them here (and we are also using them in the rest of the *path operations*). +This also means that, even though we have these two new models, **we still need the previous ones**, `HeroPublic` and `TeamPublic`, because we need to reference them here (and we are also using them in the rest of the *path operations*). ## Update the Path Operations diff --git a/docs/tutorial/fastapi/teams.md b/docs/tutorial/fastapi/teams.md index cbdb4a9..9e366f2 100644 --- a/docs/tutorial/fastapi/teams.md +++ b/docs/tutorial/fastapi/teams.md @@ -14,7 +14,7 @@ It's the same process we did for heroes, with a base model, a **table model**, a We have a `TeamBase` **data model**, and from it, we inherit with a `Team` **table model**. -Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamRead` **data models**. +Then we also inherit from the `TeamBase` for the `TeamCreate` and `TeamPublic` **data models**. And we also create a `TeamUpdate` **data model**. diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001/main.py b/docs_src/tutorial/fastapi/app_testing/tutorial001/main.py index 7014a73..f46d8b0 100644 --- a/docs_src/tutorial/fastapi/app_testing/tutorial001/main.py +++ b/docs_src/tutorial/fastapi/app_testing/tutorial001/main.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -52,7 +52,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -61,7 +61,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -72,7 +72,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -80,7 +80,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py b/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py index cf1bbb7..702eba7 100644 --- a/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py +++ b/docs_src/tutorial/fastapi/app_testing/tutorial001_py310/main.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -50,7 +50,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -59,7 +59,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -70,7 +70,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -78,7 +78,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/app_testing/tutorial001_py39/main.py b/docs_src/tutorial/fastapi/app_testing/tutorial001_py39/main.py index 9f428ab..efdfd8e 100644 --- a/docs_src/tutorial/fastapi/app_testing/tutorial001_py39/main.py +++ b/docs_src/tutorial/fastapi/app_testing/tutorial001_py39/main.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -52,7 +52,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -61,7 +61,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -72,7 +72,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -80,7 +80,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/delete/tutorial001.py b/docs_src/tutorial/fastapi/delete/tutorial001.py index 5328173..1871ab1 100644 --- a/docs_src/tutorial/fastapi/delete/tutorial001.py +++ b/docs_src/tutorial/fastapi/delete/tutorial001.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -47,7 +47,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -57,14 +57,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -73,7 +73,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/delete/tutorial001_py310.py b/docs_src/tutorial/fastapi/delete/tutorial001_py310.py index 45e2e1d..0dd0c88 100644 --- a/docs_src/tutorial/fastapi/delete/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/delete/tutorial001_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -45,7 +45,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -55,14 +55,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -71,7 +71,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/delete/tutorial001_py39.py b/docs_src/tutorial/fastapi/delete/tutorial001_py39.py index 12f6bc3..9ab3056 100644 --- a/docs_src/tutorial/fastapi/delete/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/delete/tutorial001_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -47,7 +47,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -57,14 +57,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -73,7 +73,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py index 2352f39..ccf3d77 100644 --- a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py +++ b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,14 +51,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py index ad8ff95..3402d40 100644 --- a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -39,7 +39,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -49,14 +49,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py39.py b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py39.py index b1f7cdc..3d223f3 100644 --- a/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/limit_and_offset/tutorial001_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,14 +51,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial001.py b/docs_src/tutorial/fastapi/multiple_models/tutorial001.py index 7f59ac6..42ac805 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial001.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial001.py @@ -17,7 +17,7 @@ class HeroCreate(SQLModel): age: Optional[int] = None -class HeroRead(SQLModel): +class HeroPublic(SQLModel): id: int name: str secret_name: str @@ -43,7 +43,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -53,7 +53,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py b/docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py index ff12eff..b8dc44d 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial001_py310.py @@ -15,7 +15,7 @@ class HeroCreate(SQLModel): age: int | None = None -class HeroRead(SQLModel): +class HeroPublic(SQLModel): id: int name: str secret_name: str @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,7 +51,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial001_py39.py b/docs_src/tutorial/fastapi/multiple_models/tutorial001_py39.py index 977a1ac..c6be23d 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial001_py39.py @@ -17,7 +17,7 @@ class HeroCreate(SQLModel): age: Optional[int] = None -class HeroRead(SQLModel): +class HeroPublic(SQLModel): id: int name: str secret_name: str @@ -43,7 +43,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -53,7 +53,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial002.py b/docs_src/tutorial/fastapi/multiple_models/tutorial002.py index fffbe72..79c71f1 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial002.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial002.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,7 +51,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py b/docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py index 7373edf..79e7447 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial002_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -39,7 +39,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -49,7 +49,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/multiple_models/tutorial002_py39.py b/docs_src/tutorial/fastapi/multiple_models/tutorial002_py39.py index 1b4a512..77093bc 100644 --- a/docs_src/tutorial/fastapi/multiple_models/tutorial002_py39.py +++ b/docs_src/tutorial/fastapi/multiple_models/tutorial002_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,7 +51,7 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() diff --git a/docs_src/tutorial/fastapi/read_one/tutorial001.py b/docs_src/tutorial/fastapi/read_one/tutorial001.py index f18426e..a399451 100644 --- a/docs_src/tutorial/fastapi/read_one/tutorial001.py +++ b/docs_src/tutorial/fastapi/read_one/tutorial001.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,14 +51,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/read_one/tutorial001_py310.py b/docs_src/tutorial/fastapi/read_one/tutorial001_py310.py index e8c7d49..1a46281 100644 --- a/docs_src/tutorial/fastapi/read_one/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/read_one/tutorial001_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -39,7 +39,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -49,14 +49,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/read_one/tutorial001_py39.py b/docs_src/tutorial/fastapi/read_one/tutorial001_py39.py index 4dc5702..9ac0a65 100644 --- a/docs_src/tutorial/fastapi/read_one/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/read_one/tutorial001_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -41,7 +41,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -51,14 +51,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(): with Session(engine) as session: heroes = session.exec(select(Hero)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/relationships/tutorial001.py b/docs_src/tutorial/fastapi/relationships/tutorial001.py index 51339e2..ac8a557 100644 --- a/docs_src/tutorial/fastapi/relationships/tutorial001.py +++ b/docs_src/tutorial/fastapi/relationships/tutorial001.py @@ -19,7 +19,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -43,7 +43,7 @@ class Hero(HeroBase, table=True): team: Optional[Team] = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -58,12 +58,12 @@ class HeroUpdate(SQLModel): team_id: Optional[int] = None -class HeroReadWithTeam(HeroRead): - team: Optional[TeamRead] = None +class HeroPublicWithTeam(HeroPublic): + team: Optional[TeamPublic] = None -class TeamReadWithHeroes(TeamRead): - heroes: List[HeroRead] = [] +class TeamPublicWithHeroes(TeamPublic): + heroes: List[HeroPublic] = [] sqlite_file_name = "database.db" @@ -90,7 +90,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -99,7 +99,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -110,7 +110,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroReadWithTeam) +@app.get("/heroes/{hero_id}", response_model=HeroPublicWithTeam) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -118,7 +118,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -144,7 +144,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -153,7 +153,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=List[TeamRead]) +@app.get("/teams/", response_model=List[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -164,7 +164,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamReadWithHeroes) +@app.get("/teams/{team_id}", response_model=TeamPublicWithHeroes) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -172,7 +172,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/relationships/tutorial001_py310.py b/docs_src/tutorial/fastapi/relationships/tutorial001_py310.py index 35257bd..5110b15 100644 --- a/docs_src/tutorial/fastapi/relationships/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/relationships/tutorial001_py310.py @@ -17,7 +17,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -41,7 +41,7 @@ class Hero(HeroBase, table=True): team: Team | None = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -56,12 +56,12 @@ class HeroUpdate(SQLModel): team_id: int | None = None -class HeroReadWithTeam(HeroRead): - team: TeamRead | None = None +class HeroPublicWithTeam(HeroPublic): + team: TeamPublic | None = None -class TeamReadWithHeroes(TeamRead): - heroes: list[HeroRead] = [] +class TeamPublicWithHeroes(TeamPublic): + heroes: list[HeroPublic] = [] sqlite_file_name = "database.db" @@ -88,7 +88,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -97,7 +97,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -108,7 +108,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroReadWithTeam) +@app.get("/heroes/{hero_id}", response_model=HeroPublicWithTeam) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -116,7 +116,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -142,7 +142,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -151,7 +151,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=list[TeamRead]) +@app.get("/teams/", response_model=list[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -162,7 +162,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamReadWithHeroes) +@app.get("/teams/{team_id}", response_model=TeamPublicWithHeroes) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -170,7 +170,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/relationships/tutorial001_py39.py b/docs_src/tutorial/fastapi/relationships/tutorial001_py39.py index 6ceae13..a4e953c 100644 --- a/docs_src/tutorial/fastapi/relationships/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/relationships/tutorial001_py39.py @@ -19,7 +19,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -43,7 +43,7 @@ class Hero(HeroBase, table=True): team: Optional[Team] = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -58,12 +58,12 @@ class HeroUpdate(SQLModel): team_id: Optional[int] = None -class HeroReadWithTeam(HeroRead): - team: Optional[TeamRead] = None +class HeroPublicWithTeam(HeroPublic): + team: Optional[TeamPublic] = None -class TeamReadWithHeroes(TeamRead): - heroes: list[HeroRead] = [] +class TeamPublicWithHeroes(TeamPublic): + heroes: list[HeroPublic] = [] sqlite_file_name = "database.db" @@ -90,7 +90,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -99,7 +99,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -110,7 +110,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroReadWithTeam) +@app.get("/heroes/{hero_id}", response_model=HeroPublicWithTeam) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -118,7 +118,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -144,7 +144,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -153,7 +153,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=list[TeamRead]) +@app.get("/teams/", response_model=list[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -164,7 +164,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamReadWithHeroes) +@app.get("/teams/{team_id}", response_model=TeamPublicWithHeroes) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -172,7 +172,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py index 7014a73..f46d8b0 100644 --- a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py +++ b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -52,7 +52,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -61,7 +61,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -72,7 +72,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -80,7 +80,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py index cf1bbb7..702eba7 100644 --- a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -50,7 +50,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -59,7 +59,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -70,7 +70,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -78,7 +78,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py39.py b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py39.py index 9f428ab..efdfd8e 100644 --- a/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/session_with_dependency/tutorial001_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -52,7 +52,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -61,7 +61,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -72,7 +72,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -80,7 +80,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): diff --git a/docs_src/tutorial/fastapi/teams/tutorial001.py b/docs_src/tutorial/fastapi/teams/tutorial001.py index 785c525..4289221 100644 --- a/docs_src/tutorial/fastapi/teams/tutorial001.py +++ b/docs_src/tutorial/fastapi/teams/tutorial001.py @@ -19,7 +19,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -42,7 +42,7 @@ class Hero(HeroBase, table=True): team: Optional[Team] = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -81,7 +81,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -90,7 +90,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -101,7 +101,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -109,7 +109,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -135,7 +135,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -144,7 +144,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=List[TeamRead]) +@app.get("/teams/", response_model=List[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -155,7 +155,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamRead) +@app.get("/teams/{team_id}", response_model=TeamPublic) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -163,7 +163,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/teams/tutorial001_py310.py b/docs_src/tutorial/fastapi/teams/tutorial001_py310.py index dea4bd8..630ae4f 100644 --- a/docs_src/tutorial/fastapi/teams/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/teams/tutorial001_py310.py @@ -17,7 +17,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -40,7 +40,7 @@ class Hero(HeroBase, table=True): team: Team | None = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -79,7 +79,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -88,7 +88,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -99,7 +99,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -107,7 +107,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -133,7 +133,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -142,7 +142,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=list[TeamRead]) +@app.get("/teams/", response_model=list[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -153,7 +153,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamRead) +@app.get("/teams/{team_id}", response_model=TeamPublic) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -161,7 +161,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/teams/tutorial001_py39.py b/docs_src/tutorial/fastapi/teams/tutorial001_py39.py index cc6429a..661e435 100644 --- a/docs_src/tutorial/fastapi/teams/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/teams/tutorial001_py39.py @@ -19,7 +19,7 @@ class TeamCreate(TeamBase): pass -class TeamRead(TeamBase): +class TeamPublic(TeamBase): id: int @@ -42,7 +42,7 @@ class Hero(HeroBase, table=True): team: Optional[Team] = Relationship(back_populates="heroes") -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -81,7 +81,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): db_hero = Hero.model_validate(hero) session.add(db_hero) @@ -90,7 +90,7 @@ def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes( *, session: Session = Depends(get_session), @@ -101,7 +101,7 @@ def read_heroes( return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(*, session: Session = Depends(get_session), hero_id: int): hero = session.get(Hero, hero_id) if not hero: @@ -109,7 +109,7 @@ def read_hero(*, session: Session = Depends(get_session), hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero( *, session: Session = Depends(get_session), hero_id: int, hero: HeroUpdate ): @@ -135,7 +135,7 @@ def delete_hero(*, session: Session = Depends(get_session), hero_id: int): return {"ok": True} -@app.post("/teams/", response_model=TeamRead) +@app.post("/teams/", response_model=TeamPublic) def create_team(*, session: Session = Depends(get_session), team: TeamCreate): db_team = Team.model_validate(team) session.add(db_team) @@ -144,7 +144,7 @@ def create_team(*, session: Session = Depends(get_session), team: TeamCreate): return db_team -@app.get("/teams/", response_model=list[TeamRead]) +@app.get("/teams/", response_model=list[TeamPublic]) def read_teams( *, session: Session = Depends(get_session), @@ -155,7 +155,7 @@ def read_teams( return teams -@app.get("/teams/{team_id}", response_model=TeamRead) +@app.get("/teams/{team_id}", response_model=TeamPublic) def read_team(*, team_id: int, session: Session = Depends(get_session)): team = session.get(Team, team_id) if not team: @@ -163,7 +163,7 @@ def read_team(*, team_id: int, session: Session = Depends(get_session)): return team -@app.patch("/teams/{team_id}", response_model=TeamRead) +@app.patch("/teams/{team_id}", response_model=TeamPublic) def update_team( *, session: Session = Depends(get_session), diff --git a/docs_src/tutorial/fastapi/update/tutorial001.py b/docs_src/tutorial/fastapi/update/tutorial001.py index feab25c..6a02f6c 100644 --- a/docs_src/tutorial/fastapi/update/tutorial001.py +++ b/docs_src/tutorial/fastapi/update/tutorial001.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -47,7 +47,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -57,14 +57,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -73,7 +73,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/update/tutorial001_py310.py b/docs_src/tutorial/fastapi/update/tutorial001_py310.py index 02bec2e..a98ee68 100644 --- a/docs_src/tutorial/fastapi/update/tutorial001_py310.py +++ b/docs_src/tutorial/fastapi/update/tutorial001_py310.py @@ -16,7 +16,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -45,7 +45,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -55,14 +55,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -71,7 +71,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/update/tutorial001_py39.py b/docs_src/tutorial/fastapi/update/tutorial001_py39.py index 241d205..b6d62bf 100644 --- a/docs_src/tutorial/fastapi/update/tutorial001_py39.py +++ b/docs_src/tutorial/fastapi/update/tutorial001_py39.py @@ -18,7 +18,7 @@ class HeroCreate(HeroBase): pass -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -47,7 +47,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): with Session(engine) as session: db_hero = Hero.model_validate(hero) @@ -57,14 +57,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -73,7 +73,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/update/tutorial002.py b/docs_src/tutorial/fastapi/update/tutorial002.py index 1333654..c8838ae 100644 --- a/docs_src/tutorial/fastapi/update/tutorial002.py +++ b/docs_src/tutorial/fastapi/update/tutorial002.py @@ -19,7 +19,7 @@ class HeroCreate(HeroBase): password: str -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -54,7 +54,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): hashed_password = hash_password(hero.password) with Session(engine) as session: @@ -66,14 +66,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=List[HeroRead]) +@app.get("/heroes/", response_model=List[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -82,7 +82,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/update/tutorial002_py310.py b/docs_src/tutorial/fastapi/update/tutorial002_py310.py index 6be274e..d250fec 100644 --- a/docs_src/tutorial/fastapi/update/tutorial002_py310.py +++ b/docs_src/tutorial/fastapi/update/tutorial002_py310.py @@ -17,7 +17,7 @@ class HeroCreate(HeroBase): password: str -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -52,7 +52,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): hashed_password = hash_password(hero.password) with Session(engine) as session: @@ -64,14 +64,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -80,7 +80,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/docs_src/tutorial/fastapi/update/tutorial002_py39.py b/docs_src/tutorial/fastapi/update/tutorial002_py39.py index 19d30ea..14ad1b4 100644 --- a/docs_src/tutorial/fastapi/update/tutorial002_py39.py +++ b/docs_src/tutorial/fastapi/update/tutorial002_py39.py @@ -19,7 +19,7 @@ class HeroCreate(HeroBase): password: str -class HeroRead(HeroBase): +class HeroPublic(HeroBase): id: int @@ -54,7 +54,7 @@ def on_startup(): create_db_and_tables() -@app.post("/heroes/", response_model=HeroRead) +@app.post("/heroes/", response_model=HeroPublic) def create_hero(hero: HeroCreate): hashed_password = hash_password(hero.password) with Session(engine) as session: @@ -66,14 +66,14 @@ def create_hero(hero: HeroCreate): return db_hero -@app.get("/heroes/", response_model=list[HeroRead]) +@app.get("/heroes/", response_model=list[HeroPublic]) def read_heroes(offset: int = 0, limit: int = Query(default=100, le=100)): with Session(engine) as session: heroes = session.exec(select(Hero).offset(offset).limit(limit)).all() return heroes -@app.get("/heroes/{hero_id}", response_model=HeroRead) +@app.get("/heroes/{hero_id}", response_model=HeroPublic) def read_hero(hero_id: int): with Session(engine) as session: hero = session.get(Hero, hero_id) @@ -82,7 +82,7 @@ def read_hero(hero_id: int): return hero -@app.patch("/heroes/{hero_id}", response_model=HeroRead) +@app.patch("/heroes/{hero_id}", response_model=HeroPublic) def update_hero(hero_id: int, hero: HeroUpdate): with Session(engine) as session: db_hero = session.get(Hero, hero_id) diff --git a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py index 706cc8a..f293199 100644 --- a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001.py @@ -99,7 +99,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -136,7 +136,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -172,7 +172,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -244,7 +244,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -297,8 +297,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py310.py index 46c8c42..2757c87 100644 --- a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py310.py @@ -102,7 +102,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -139,7 +139,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -175,7 +175,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -247,7 +247,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -300,8 +300,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py39.py index e2874c1..3299086 100644 --- a/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_delete/test_tutorial001_py39.py @@ -102,7 +102,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -139,7 +139,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -175,7 +175,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -247,7 +247,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -300,8 +300,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py index d177c80..4047539 100644 --- a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001.py @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -141,7 +141,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -177,7 +177,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -230,8 +230,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py310.py index 0308699..480b92a 100644 --- a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py310.py @@ -107,7 +107,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -144,7 +144,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -180,7 +180,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -233,8 +233,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py39.py index f7e42e4..0a9d5c9 100644 --- a/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_limit_and_offset/test_tutorial001_py39.py @@ -107,7 +107,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -144,7 +144,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -180,7 +180,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -233,8 +233,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py index 2ebfc0c..276a021 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001.py @@ -74,7 +74,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -101,7 +101,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -154,8 +154,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["id", "name", "secret_name"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py310.py index c17e482..b6f082a 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py310.py @@ -76,7 +76,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -103,7 +103,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -156,8 +156,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["id", "name", "secret_name"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py39.py index 258b3a4..82365ce 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial001_py39.py @@ -77,7 +77,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -157,8 +157,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["id", "name", "secret_name"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py index 47f2e64..8327c6d 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002.py @@ -74,7 +74,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -101,7 +101,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -154,8 +154,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py310.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py310.py index c09b15b..30edc4d 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py310.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py310.py @@ -77,7 +77,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -157,8 +157,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py39.py b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py39.py index 8ad0f27..2b86d3f 100644 --- a/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py39.py +++ b/tests/test_tutorial/test_fastapi/test_multiple_models/test_tutorial002_py39.py @@ -77,7 +77,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -157,8 +157,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py index 62fbb25..9b1d527 100644 --- a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001.py @@ -59,7 +59,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -86,7 +86,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -122,7 +122,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -175,8 +175,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py310.py index 913d098..f18b0d6 100644 --- a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py310.py @@ -62,7 +62,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -89,7 +89,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -125,7 +125,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -178,8 +178,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py39.py index 9bedf5c..4423d1a 100644 --- a/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_read_one/test_tutorial001_py39.py @@ -62,7 +62,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -89,7 +89,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -125,7 +125,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -178,8 +178,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py index b301697..4b4f47b 100644 --- a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001.py @@ -147,7 +147,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -184,7 +184,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -220,7 +220,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroReadWithTeam" + "$ref": "#/components/schemas/HeroPublicWithTeam" } } }, @@ -292,7 +292,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -346,7 +346,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -383,7 +383,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -419,7 +419,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamReadWithHeroes" + "$ref": "#/components/schemas/TeamPublicWithHeroes" } } }, @@ -491,7 +491,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -554,8 +554,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -584,8 +584,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "HeroReadWithTeam": { - "title": "HeroReadWithTeam", + "HeroPublicWithTeam": { + "title": "HeroPublicWithTeam", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -615,14 +615,14 @@ def test_tutorial(clear_sqlmodel): "team": IsDict( { "anyOf": [ - {"$ref": "#/components/schemas/TeamRead"}, + {"$ref": "#/components/schemas/TeamPublic"}, {"type": "null"}, ] } ) | IsDict( # TODO: remove when deprecating Pydantic v1 - {"$ref": "#/components/schemas/TeamRead"} + {"$ref": "#/components/schemas/TeamPublic"} ), }, }, @@ -681,8 +681,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -691,8 +691,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "TeamReadWithHeroes": { - "title": "TeamReadWithHeroes", + "TeamPublicWithHeroes": { + "title": "TeamPublicWithHeroes", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -702,7 +702,7 @@ def test_tutorial(clear_sqlmodel): "heroes": { "title": "Heroes", "type": "array", - "items": {"$ref": "#/components/schemas/HeroRead"}, + "items": {"$ref": "#/components/schemas/HeroPublic"}, "default": [], }, }, diff --git a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py310.py index 4d310a8..dcb78f5 100644 --- a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py310.py @@ -150,7 +150,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -187,7 +187,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -223,7 +223,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroReadWithTeam" + "$ref": "#/components/schemas/HeroPublicWithTeam" } } }, @@ -295,7 +295,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -349,7 +349,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -386,7 +386,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -422,7 +422,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamReadWithHeroes" + "$ref": "#/components/schemas/TeamPublicWithHeroes" } } }, @@ -494,7 +494,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -557,8 +557,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -587,8 +587,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "HeroReadWithTeam": { - "title": "HeroReadWithTeam", + "HeroPublicWithTeam": { + "title": "HeroPublicWithTeam", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -618,14 +618,14 @@ def test_tutorial(clear_sqlmodel): "team": IsDict( { "anyOf": [ - {"$ref": "#/components/schemas/TeamRead"}, + {"$ref": "#/components/schemas/TeamPublic"}, {"type": "null"}, ] } ) | IsDict( # TODO: remove when deprecating Pydantic v1 - {"$ref": "#/components/schemas/TeamRead"} + {"$ref": "#/components/schemas/TeamPublic"} ), }, }, @@ -684,8 +684,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -694,8 +694,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "TeamReadWithHeroes": { - "title": "TeamReadWithHeroes", + "TeamPublicWithHeroes": { + "title": "TeamPublicWithHeroes", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -705,7 +705,7 @@ def test_tutorial(clear_sqlmodel): "heroes": { "title": "Heroes", "type": "array", - "items": {"$ref": "#/components/schemas/HeroRead"}, + "items": {"$ref": "#/components/schemas/HeroPublic"}, "default": [], }, }, diff --git a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py39.py index 0603739..5ef7338 100644 --- a/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_relationships/test_tutorial001_py39.py @@ -150,7 +150,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -187,7 +187,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -223,7 +223,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroReadWithTeam" + "$ref": "#/components/schemas/HeroPublicWithTeam" } } }, @@ -295,7 +295,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -349,7 +349,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -386,7 +386,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -422,7 +422,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamReadWithHeroes" + "$ref": "#/components/schemas/TeamPublicWithHeroes" } } }, @@ -494,7 +494,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -557,8 +557,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -587,8 +587,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "HeroReadWithTeam": { - "title": "HeroReadWithTeam", + "HeroPublicWithTeam": { + "title": "HeroPublicWithTeam", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -618,14 +618,14 @@ def test_tutorial(clear_sqlmodel): "team": IsDict( { "anyOf": [ - {"$ref": "#/components/schemas/TeamRead"}, + {"$ref": "#/components/schemas/TeamPublic"}, {"type": "null"}, ] } ) | IsDict( # TODO: remove when deprecating Pydantic v1 - {"$ref": "#/components/schemas/TeamRead"} + {"$ref": "#/components/schemas/TeamPublic"} ), }, }, @@ -684,8 +684,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -694,8 +694,8 @@ def test_tutorial(clear_sqlmodel): "id": {"title": "Id", "type": "integer"}, }, }, - "TeamReadWithHeroes": { - "title": "TeamReadWithHeroes", + "TeamPublicWithHeroes": { + "title": "TeamPublicWithHeroes", "required": ["name", "headquarters", "id"], "type": "object", "properties": { @@ -705,7 +705,7 @@ def test_tutorial(clear_sqlmodel): "heroes": { "title": "Heroes", "type": "array", - "items": {"$ref": "#/components/schemas/HeroRead"}, + "items": {"$ref": "#/components/schemas/HeroPublic"}, "default": [], }, }, diff --git a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py index 441cc42..388cfa9 100644 --- a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001.py @@ -99,7 +99,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -136,7 +136,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -172,7 +172,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -244,7 +244,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -297,8 +297,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py310.py index 7c427a1..65bab47 100644 --- a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py310.py @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -141,7 +141,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -177,7 +177,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -249,7 +249,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -302,8 +302,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py39.py index ea63f52..cdab85d 100644 --- a/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_session_with_dependency/test_tutorial001_py39.py @@ -104,7 +104,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -141,7 +141,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -177,7 +177,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -249,7 +249,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -302,8 +302,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py index a532625..25daadf 100644 --- a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001.py @@ -134,7 +134,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -171,7 +171,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -207,7 +207,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -279,7 +279,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -333,7 +333,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -370,7 +370,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -406,7 +406,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -478,7 +478,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -541,8 +541,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -626,8 +626,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py310.py index 33029f6..63f8a1d 100644 --- a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py310.py @@ -137,7 +137,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -174,7 +174,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -210,7 +210,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -282,7 +282,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -336,7 +336,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -373,7 +373,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -409,7 +409,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -481,7 +481,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -544,8 +544,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -629,8 +629,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py39.py index 66705e1..30b68e0 100644 --- a/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_teams/test_tutorial001_py39.py @@ -137,7 +137,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -174,7 +174,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -210,7 +210,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -282,7 +282,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -336,7 +336,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Teams Teams Get", "type": "array", "items": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" }, } } @@ -373,7 +373,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -409,7 +409,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -481,7 +481,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/TeamRead" + "$ref": "#/components/schemas/TeamPublic" } } }, @@ -544,8 +544,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { @@ -629,8 +629,8 @@ def test_tutorial(clear_sqlmodel): "headquarters": {"title": "Headquarters", "type": "string"}, }, }, - "TeamRead": { - "title": "TeamRead", + "TeamPublic": { + "title": "TeamPublic", "required": ["name", "headquarters", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py index 973ab2d..0856b24 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001.py @@ -106,7 +106,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -143,7 +143,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -179,7 +179,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -223,7 +223,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -276,8 +276,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py310.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py310.py index 090af8c..d79b2ec 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py310.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py310.py @@ -109,7 +109,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -146,7 +146,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -182,7 +182,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -226,7 +226,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -279,8 +279,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py39.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py39.py index 22dfb8f..1be81de 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py39.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial001_py39.py @@ -109,7 +109,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -146,7 +146,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -182,7 +182,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -226,7 +226,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -279,8 +279,8 @@ def test_tutorial(clear_sqlmodel): ), }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py index 21ca74e..32e343e 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002.py @@ -169,7 +169,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -206,7 +206,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -242,7 +242,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -286,7 +286,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -340,8 +340,8 @@ def test_tutorial(clear_sqlmodel): "password": {"type": "string", "title": "Password"}, }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py310.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py310.py index 6feb1ec..b05f5b2 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py310.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py310.py @@ -172,7 +172,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -209,7 +209,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -245,7 +245,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -289,7 +289,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -343,8 +343,8 @@ def test_tutorial(clear_sqlmodel): "password": {"type": "string", "title": "Password"}, }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": { diff --git a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py39.py b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py39.py index 13d70dd..807e334 100644 --- a/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py39.py +++ b/tests/test_tutorial/test_fastapi/test_update/test_tutorial002_py39.py @@ -172,7 +172,7 @@ def test_tutorial(clear_sqlmodel): "title": "Response Read Heroes Heroes Get", "type": "array", "items": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" }, } } @@ -209,7 +209,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -245,7 +245,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -289,7 +289,7 @@ def test_tutorial(clear_sqlmodel): "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/HeroRead" + "$ref": "#/components/schemas/HeroPublic" } } }, @@ -343,8 +343,8 @@ def test_tutorial(clear_sqlmodel): "password": {"type": "string", "title": "Password"}, }, }, - "HeroRead": { - "title": "HeroRead", + "HeroPublic": { + "title": "HeroPublic", "required": ["name", "secret_name", "id"], "type": "object", "properties": {