📝 Update instructions about how to make a foreign key required in docs/tutorial/relationship-attributes/define-relationships-attributes.md
#474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
default
parameter of theField
object, 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
heroes
endpoint.team_id
shouldn't be mandatory. But if you remove thedefault
parameter of theField
object of theteam_id
attribute, it should become mandatoryps: I'm having tons of fun with your libraries! thanks