Skip to content
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

[FEATURE] graphql not required handling #1994

Open
devkral opened this issue Jan 25, 2024 · 1 comment
Open

[FEATURE] graphql not required handling #1994

devkral opened this issue Jan 25, 2024 · 1 comment
Assignees
Labels
Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Specification: GraphQL Specific to GraphQL Type: Feature New functionalities or enhancements

Comments

@devkral
Copy link
Contributor

devkral commented Jan 25, 2024

Currently when fields in graphql schemas are not required, schemathesis can send null to them.
According to the graphql specs this is valid and it is useful to find bugs.

But sometimes it would be easier to not send null values

Is there a way to turn the null value sending behavior off? It would be nice to have a simple switch for it

@devkral devkral added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Feature New functionalities or enhancements labels Jan 25, 2024
@Stranger6667
Copy link
Member

I see it this way.

First, it should be added to hypothesis-graphql, ie. some argument to the strategy factories like allow_null: bool = True, then store it on the GraphQLStrategy instance and use it here to enforce non-nullability during data generation (i.e. before passing this to primitives.scalar, etc)

Second, this option should be added to Schemathesis CLI & other entry points to propagate it down via as_strategy to hypothesis-graphql

@Stranger6667 Stranger6667 added Specification: GraphQL Specific to GraphQL Priority: Medium Planned for regular releases Difficulty: Intermediate Requires some experience and removed Status: Needs Triage Requires initial assessment to categorize and prioritize labels Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Intermediate Requires some experience Priority: Medium Planned for regular releases Specification: GraphQL Specific to GraphQL Type: Feature New functionalities or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants