Uh oh!
There was an error while loading. Please reload this page.
📝 Update instructions about how to make a foreign key required in docs/tutorial/relationship-attributes/define-relationships-attributes.md - #474
Conversation
📝 Docs preview for commit b3386f3 at: https://635230ff381fa0723e828238--sqlmodel.netlify.app |
Codecov ReportBase: 98.49% // Head: 98.49% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@## main #474 +/- ##
=======================================
Coverage 98.49% 98.49% =======================================
Files 185 185 Lines 5856 5856 =======================================
Hits 5768 5768 Misses 88 88 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
📝 Docs preview for commit 8b6a4d6 at: https://639ce0735cc7fa00ac620965--sqlmodel.netlify.app |
docs/tutorial/relationship-attributes/define-relationships-attributes.mdtiangolo
commented
Oct 22, 2023
Great, thanks! 🍰 |
Hi 👋
I wanted to make a foreign key mandatory and I think that this part of the tutorial was talking about that. I followed those steps but the foreign key wasn't mandatory yet. It didn't show the red "*" on the Swagger interface and my unit tests were passing without it.
I completely removed the the
defaultparameter of theFieldobject, of the foreign key, and after that, I got the red "*" and my unit tests started to fail.I'm not sure if this is how it is supposed to be done, but in case it is, here is the PR :)
Just in case, here I'm sharing a little code with an app to test this. First run it as it is (the current state of the code is after applying the instructions of the docs before this PR) and then go to the /docs and check the schema for the
heroesendpoint.team_idshouldn't be mandatory. But if you remove thedefaultparameter of theFieldobject of theteam_idattribute, it should become mandatoryps: I'm having tons of fun with your libraries! thanks