Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Exclude unset fields#168

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
dima-dmytruk23 wants to merge2 commits intographql-python:main
base:main
Choose a base branch
Loading
fromdima-dmytruk23:main

Conversation

dima-dmytruk23
Copy link

Original discussion:graphql-python/graphene-pydantic#75

I usegraphene andgraphene-pydantic libraries.
Code example:
https://gist.github.com/dima-dmytruk23/aaeba0fbc7a539c1f8bf3d0914fce580

The client does not pass the name field, but it is still present in themutation asNone. Input query turns into aUserUpdateInput, which is when the default values are filled in to the dictionary. So then when your code passes the dictionary in to build theUserUpdate, it sets all the fields -- soexclude_unset doesn't exclude anything, since all the fields were in fact set.

I am fairly sure it's not ingraphene-pydantic, though, since that is only responsible for converting to theGrapheneInputObjectType.

I propose to resolve this issue by adding theexclude unset flag to theGraphQLSchema class and use it in thecoerce_input_value function.

@Cito
Copy link
Member

Hi@dima-dmytruk23, and thanks for contributing.

Please understand that the scope of GraphQL-core is to be a straight-forward port of GraphQL.js, so I am very reluctant to add features that are not part of GraphQL.js or change the API. I'm not saying that we can never do this, and we in fact have serveral such extensions, but you really need to have convincing reasons why this is necessary. Any such extension makes maintaining GraphQL-core and keeping it in sync with GraphQL.js more difficult as they sum up.

Therefore, could you please first open an issue and explain what the feature tries to achieve, and how it could be useful and why it cannot be achieved in other ways, with example code, independent of Graphene or Graphene-Pydantic? We also require unit tests, and this will help to create them.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@CitoCitoAwaiting requested review from CitoCito is a code owner

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@dima-dmytruk23@Cito

[8]ページ先頭

©2009-2025 Movatter.jp