* `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
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
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+
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.
## 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.
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+
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+
Now, remember that <a href="https://fastapi.tiangolo.com/tutorial/response-model/" class="external-link" target="_blank">FastAPI uses the `response_model` to validate and **filter** the response data</a>?
-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+
## 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.
### 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
### 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
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**.
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
age: Optional[int] = None
-class HeroRead(SQLModel):
+class HeroPublic(SQLModel):
id: int
name: str
secret_name: str
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)
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()
age: int | None = None
-class HeroRead(SQLModel):
+class HeroPublic(SQLModel):
id: int
name: str
secret_name: str
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)
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()
age: Optional[int] = None
-class HeroRead(SQLModel):
+class HeroPublic(SQLModel):
id: int
name: str
secret_name: str
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)
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()
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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()
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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()
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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()
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Optional[Team] = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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"
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Team | None = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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"
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Optional[Team] = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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"
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Optional[Team] = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Team | None = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class TeamRead(TeamBase):
+class TeamPublic(TeamBase):
id: int
team: Optional[Team] = Relationship(back_populates="heroes")
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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),
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:
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
):
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)
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),
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:
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),
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
pass
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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)
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)
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)
password: str
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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:
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)
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)
password: str
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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:
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)
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)
password: str
-class HeroRead(HeroBase):
+class HeroPublic(HeroBase):
id: int
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:
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)
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)
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["id", "name", "secret_name"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["id", "name", "secret_name"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["id", "name", "secret_name"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroReadWithTeam"
+ "$ref": "#/components/schemas/HeroPublicWithTeam"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamReadWithHeroes"
+ "$ref": "#/components/schemas/TeamPublicWithHeroes"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "HeroReadWithTeam": {
- "title": "HeroReadWithTeam",
+ "HeroPublicWithTeam": {
+ "title": "HeroPublicWithTeam",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"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"}
),
},
},
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "TeamReadWithHeroes": {
- "title": "TeamReadWithHeroes",
+ "TeamPublicWithHeroes": {
+ "title": "TeamPublicWithHeroes",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"heroes": {
"title": "Heroes",
"type": "array",
- "items": {"$ref": "#/components/schemas/HeroRead"},
+ "items": {"$ref": "#/components/schemas/HeroPublic"},
"default": [],
},
},
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroReadWithTeam"
+ "$ref": "#/components/schemas/HeroPublicWithTeam"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamReadWithHeroes"
+ "$ref": "#/components/schemas/TeamPublicWithHeroes"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "HeroReadWithTeam": {
- "title": "HeroReadWithTeam",
+ "HeroPublicWithTeam": {
+ "title": "HeroPublicWithTeam",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"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"}
),
},
},
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "TeamReadWithHeroes": {
- "title": "TeamReadWithHeroes",
+ "TeamPublicWithHeroes": {
+ "title": "TeamPublicWithHeroes",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"heroes": {
"title": "Heroes",
"type": "array",
- "items": {"$ref": "#/components/schemas/HeroRead"},
+ "items": {"$ref": "#/components/schemas/HeroPublic"},
"default": [],
},
},
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroReadWithTeam"
+ "$ref": "#/components/schemas/HeroPublicWithTeam"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamReadWithHeroes"
+ "$ref": "#/components/schemas/TeamPublicWithHeroes"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "HeroReadWithTeam": {
- "title": "HeroReadWithTeam",
+ "HeroPublicWithTeam": {
+ "title": "HeroPublicWithTeam",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"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"}
),
},
},
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"id": {"title": "Id", "type": "integer"},
},
},
- "TeamReadWithHeroes": {
- "title": "TeamReadWithHeroes",
+ "TeamPublicWithHeroes": {
+ "title": "TeamPublicWithHeroes",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"heroes": {
"title": "Heroes",
"type": "array",
- "items": {"$ref": "#/components/schemas/HeroRead"},
+ "items": {"$ref": "#/components/schemas/HeroPublic"},
"default": [],
},
},
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"title": "Response Read Teams Teams Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/TeamRead"
+ "$ref": "#/components/schemas/TeamPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"headquarters": {"title": "Headquarters", "type": "string"},
},
},
- "TeamRead": {
- "title": "TeamRead",
+ "TeamPublic": {
+ "title": "TeamPublic",
"required": ["name", "headquarters", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
),
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"password": {"type": "string", "title": "Password"},
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"password": {"type": "string", "title": "Password"},
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {
"title": "Response Read Heroes Heroes Get",
"type": "array",
"items": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
},
}
}
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"content": {
"application/json": {
"schema": {
- "$ref": "#/components/schemas/HeroRead"
+ "$ref": "#/components/schemas/HeroPublic"
}
}
},
"password": {"type": "string", "title": "Password"},
},
},
- "HeroRead": {
- "title": "HeroRead",
+ "HeroPublic": {
+ "title": "HeroPublic",
"required": ["name", "secret_name", "id"],
"type": "object",
"properties": {