Skip to content

Conversation

@rsill-neo4j
Copy link
Contributor

@rsill-neo4j rsill-neo4j commented Sep 22, 2025

this PR is kinda dependent on #274 now
would be good to publish them simultaneously
274 has two js examples missing

@rsill-neo4j rsill-neo4j requested a review from mjfwebb September 22, 2025 12:05
@luffy1727 luffy1727 marked this pull request as draft October 21, 2025 12:08
@rsill-neo4j rsill-neo4j marked this pull request as ready for review October 24, 2025 08:22
@neo4j-docops-agent
Copy link
Collaborator

This PR includes documentation updates
View the updated docs at https://neo4j-docs-graphql-280.surge.sh

New pages:

Copy link

@keremgocen keremgocen left a comment

Choose a reason for hiding this comment

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

It's looking good so far and has valuable information. However there are a few typos and I think we can make it more practical with some code examples. I left a few comments.


For the same reason it is advisable to avoid introspection and data field suggestions, it can make your API more secure to catch internal errors and redact which information you want to pass on to the end user.

For example, the following error reveals information XY:

Choose a reason for hiding this comment

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

Was this also a placeholder XY? feels like the JSON example here could be more illustrative?


[source, graphql, indent=0]
----
// example

Choose a reason for hiding this comment

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

missing example here I think?

There are many ways and places to use timeouts.
Here are a few examples.

// examples

Choose a reason for hiding this comment

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

missing example?


Follow the input validation methods summarized in the link:https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html#input-validation[OWASP Cheat Sheet Series].

// Examples?

Choose a reason for hiding this comment

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

also here, do we want an actual example?

----
import depthLimit from 'graphql-depth-limit'
import express from 'express'
import graphqlHTTP from 'express-graphql'

Choose a reason for hiding this comment

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

should we maybe use a more up to date example here? we could replace the deprecated express-graphql with graphql-http, apparently. (cc: @mjfwebb)

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll replace this example with an example using GraphQL Armor

Comment on lines +408 to +464
Returning large query result lists can negatively affect server performance.
For example, a query like the following would return a siginificant number of nodes:

[source, graphql, indent=0]
----
query {
order(first: 1000) {
orderID
products(last: 100) {
productName
productCategory
}
}
}
----

To avoid this, you can cap the input number directly in your resolvers, for example like this:

[source, graphql, indent=0]
----
// example
----

Alternatively, use a library such as link:https://github.com/joonhocho/graphql-input-number[graphql-input-number]:

[source, typescript, indent=0]
----
import {
GraphQLInputInt,
GraphQLInputFloat,
} from 'graphql-input-number';

const argType = GraphQLInputInt({
name: 'OneToNineInt',
min: 1,
max: 9,
});

new GraphQLObjectType({
name: 'Query',
fields: {
input: {
type: GraphQLInt,
args: {
number: {
type: argType,
},
},
resolve: (_, {number}) => {

// 'number' IS AN INT BETWEEN 1 to 9.

};
},
},
});
----
Copy link
Contributor Author

Choose a reason for hiding this comment

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

replace with type definition solution (server side)
mention: denial of service prevention

Comment on lines +479 to +485
==== Query cost points

The link:https://shopify.dev/docs/api/usage/limits#the-leaky-bucket-algorithm[leaky bucket algorithm].

==== Query cost analysis

link:https://github.com/pa-bru/graphql-cost-analysis[graphql-cost-analysis]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

link to graphql armor

Comment on lines +490 to +496
To prevent the API from not responding or falling victim to denial of service attacks, it is feasible to make use of timeouts.
This way, subsequent queries will not be blocked by a long-running previous query.

There are many ways and places to use timeouts.
Here are a few examples.

// examples
Copy link
Contributor Author

Choose a reason for hiding this comment

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

refer to transaction config in context

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants