You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is done in some cases but not all. In cases where a base table is reused across contexts (models.User, models.Lender and models.CreditProduct), the field (like borrower_types) ends up being included where it's not intended.
That said, we might conclude that the situation is "good enough" - in which case this becomes a documentation issue (see below horizontal rule).
This mainly affects the user, lender and credit product models.
In some places, the backend uses the same model for different frontend interfaces. For example:
I listed all the obvious cases above, but I didn't go through cases where a schema or model is wrapped inside another, like with IApplicationCreditOptions above.
https://sqlmodel.tiangolo.com/tutorial/fastapi/multiple-models/
Moved from open-contracting/credere-frontend#124
In principle, the API should not be returning data that the frontend does not need or use. FastAPI recommends separate models for parsers, serializers and database tables.
This is done in some cases but not all. In cases where a base table is reused across contexts (models.User, models.Lender and models.CreditProduct), the field (like
borrower_types
) ends up being included where it's not intended.That said, we might conclude that the situation is "good enough" - in which case this becomes a documentation issue (see below horizontal rule).
This mainly affects the user, lender and credit product models.
In some places, the backend uses the same model for different frontend interfaces. For example:
In other places, the backend uses different models for the same frontend interface. For example:
I listed all the obvious cases above, but I didn't go through cases where a schema or model is wrapped inside another, like with IApplicationCreditOptions above.
See https://credere.readthedocs.io/en/latest/frontend.html#schemas-and-models Sorting by different columns makes it easier to see where maybe there's an opportunity to improve the implementation.
Even without doing the above, we should document how we want to implement the approach in https://sqlmodel.tiangolo.com/tutorial/fastapi/multiple-models/, to be consistent going forward.
The text was updated successfully, but these errors were encountered: