whythawk / full-stack-fastapi-postgresql

Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Nuxt3, Docker, automatic HTTPS and more.
MIT License
231 stars 47 forks source link

Nested model list #42

Closed podaga closed 10 months ago

podaga commented 10 months ago

Hello and thanks again for this marvellous stack !

I am trying to integrate a nested model and return a list.

This works fine for a single object, but not lists.

For example, simply adding "owner: User" to schemas in a related table returns the appropriate owner with related schema.

But I get "value is not a valid list (type=type_error.list)" if I try something such as "itemsRelation: list[ItemsSchema]".

The response returns a list and works well individually, but perhaps not in the correct format.

I will send a pull request for items table and related tests once this is running.

Thank you.

podaga commented 10 months ago

Sorted...with good sleep I found the issue in models.