Releases: hxjo/fastapi-inertia
1.0.3
What's Changed
- Unpin FastAPI and Jinja2 deps to allow to install with latest versions by @holandes22 in #28
Full Changelog: 1.0.2...1.0.3
1.0.2
1.0.1
1.0.0
Here comes version 1.0.0 !
Thanks to proposals from @ndilsou, and by taking great inspiration from the code he provided in a fork, the following improvements have been made over the past few days:
- Leverage Jinja2 templating instead of raw HTML, allowing for easier customization of the template by library users
- Rework InertiaConfig options to allow for easier configuration, mainly on:
- webapp file entrypoint
- root webapp directory
- assets prefix
- Make testing easier by leveraging BeautifulSoup
- Improve performances by:
- Caching vite manifest
- Using HTTPX instead of requests to make async request and avoid blocking the thread
Thanks again for the proposals @ndilsou !
What's Changed
Full Changelog: 0.1.7...1.0.0
0.1.7
0.1.6
Fix: Better JSONification of pydantic models
Context
When building props, Pydantic models were converted to dict using Pydantic's model_dump
method, which converts the model to a dict.
When an Inertia call was made, a simple JSONResponse
(FastAPI's one) was returned, with the props.
However, JSONResponse does not handle some fields, such as datetime
, and would require either:
- Handling those prior to passing the models to the
render
method of inertia - Overriding the
render
method of inertia in order to use a customJSONResponse
which would handle those cases
This is very unoptimal.
Solution
-
Instead of using Pydantic's
model_dump
method, use itsmodel_dump_json
method which handles much more types, and usejson.loads
to convert it back to a dict. -
Expose a
_render_json
method so it can be easily overridden, without having to override the wholerender
method.