Skip to content

Conversation

@abhishekkumams
Copy link
Contributor

@abhishekkumams abhishekkumams commented Jun 14, 2024

Why make this change?

What is this change?

  • Using .AddMaxExecutionDepthRule provided by Hot Chocolate.
  • Added in the StartUp, will be setup during the startup.
  • Updated dab.draft.schema.json file to allow both integer and null value for depth-limit.
  • NOTE: Currently this feature is only for Non-Hosted Scenario.
  • Introspection Queries are not impacted.

How was this tested?

  • Integration Tests

Sample Request(s)

#nested depth: 8

{
    books(filter: {id: {eq: 1}}){
        items{
            id
            title
            publishers {
                id
                name
                books (filter: {authors: {id: {isNull: false}}}){
                    items {
                        authors{
                            items{
                                id
                                name
                            }
                        }
                    }
                }
            }
        }
    }
}

image

nested depth: 3

{
    book_by_pk(id: 2){
        id
        publishers {
            id
            name
        }
    }
}

image

Mutation (nested depth: 7)

mutation {
    createbook(item: {title: "My New Book", publisher_id: 1234}) {
        id
        title
        publishers {
            id
            name
            books (filter: {authors: {id: {isNull: false}}}){
                items {
                    authors{
                        items{
                            id
                            name
                        }
                    }
                }
            }
        }
    }
}

image

@abhishekkumams abhishekkumams changed the title Implement depth-limit to GraphQL Queries/Mutation operations Implement depth-limit to GraphQL Queries/Mutation operations For Non-Hosted Scenario Jun 14, 2024
@abhishekkumams abhishekkumams marked this pull request as draft June 14, 2024 10:52
@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams self-assigned this Jun 17, 2024
@abhishekkumams abhishekkumams added the enhancement New feature or request label Jun 17, 2024
@abhishekkumams abhishekkumams added this to the 1.2 milestone Jun 17, 2024
@abhishekkumams abhishekkumams marked this pull request as ready for review June 17, 2024 13:07
@abhishekkumams
Copy link
Contributor Author

/azp run

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some test structure changes requested and more comments needed.

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some additional suggestions/nits based on latest changes.

@abhishekkumams
Copy link
Contributor Author

/azp run

Copy link
Contributor

@seantleonard seantleonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

few nits. Looks good! thank you for making these features additions and testing.

@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams requested a review from ayush3797 June 21, 2024 16:31
@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams
Copy link
Contributor Author

/azp run

Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@abhishekkumams
Copy link
Contributor Author

/azp run

@abhishekkumams abhishekkumams merged commit 3b58f34 into main Jul 3, 2024
@abhishekkumams abhishekkumams deleted the dev/abhishekkuma/add-nesting-limit-gql-queries branch July 3, 2024 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add support for defining a limit in how nested queries can be

5 participants