-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required/NonNull behaviour for Pydantic fields with defaults #48
Comments
@daviddaskell thanks for this! I am not using If you do end up submitting the PR, could you include the fix you suggested for Lists of non-null elements as well? |
Sure, happy to. Am I correct in saying that the latest version only works with Graphene 3? In which case we'll probably have to keep a 0.1.0 fork going as well until the Graphene 3 release happens with all the dependent libraries. |
That's right, currently 0.2.0 only supports Graphene 3. I'd welcome any changes that make it compatible with 2.x and 3.x, but also happy to maintain an 0.1.x branch (and release builds to PyPI). |
@davidkell |
We think the following code produces an incorrect schema:
Result:
AFAICT, the
Int
field onExampleType
should not be nullable, since there will always be a default value and this value cannot be null. Instead it should be:I think it's a one line fix here, you need to change:
to
For reference, the Pydantic docs on distinguishing nullability (optional) and required fields.
If you agree with this, I'm happy to submit a PR - we are already doing this on our fork.
The text was updated successfully, but these errors were encountered: