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

Documentation for 2.0.0 #242

Merged
merged 8 commits into from
Jun 15, 2021
Merged
2 changes: 2 additions & 0 deletions docs/antora/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@
**** xref:guides/migration-guide/type-definitions/index.adoc[]
**** xref:guides/migration-guide/queries/index.adoc[]
**** xref:guides/migration-guide/mutations/index.adoc[]
*** xref:guides/rel-migration/index.adoc[]
**** xref:guides/rel-migration/mutations/index.adoc[]
** xref:troubleshooting/index.adoc[]
25 changes: 21 additions & 4 deletions docs/asciidoc/auth/setup.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ Auth centric values on the Config object passed to Neo4jGraphQL or OGM.
| Specify JWT secret

|`noVerify`
| Disable the verification of the JW
| Disable the verification of the JWT

|`rolesPath`
| Specify where on the JWT the roles key is
|===

== Server Construction
Request object needs to be injected into the context before you can use auth. Here is an example using Apollo Server;

*An object key `req` or `request` must be passed into the context before you can use auth.* This object must contain request headers, including the authorization header containing the JWT for each request.

Here is an example using Apollo Server:

[source, javascript]
----
Expand All @@ -48,6 +51,16 @@ const server = new ApolloServer({
});
----

We expect there to be a `headers` key within either a `req` or `request` object in the context. If for example, you are using `apollo-server-lambda` to host a GraphQL API as a lambda function, the context function will have an `event` object which will need to be renamed to `req`. For example:

[source, javascript]
----
const server = new ApolloServer({
schema: neoSchema.schema,
context: ({ event }) => ({ req: event }),
});
----

== `rules`

You can have many rules for many operations. We fall through each rule, on the corresponding operation, until we find a match. On no match found, an error is thrown. You can think of rules as a big OR.
Expand Down Expand Up @@ -83,8 +96,12 @@ mutation {
createPosts(
input: [
{
content: "I like GraphQL",
creator: { connect: { where: { id: "user-01" } } }
content: "I like GraphQL"
creator: {
connect: {
where: { id: "user-01" }
}
}
}
]
) {
Expand Down
4 changes: 4 additions & 0 deletions docs/asciidoc/custom-resolvers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

The library will autogenerate Query and Mutation resolvers, so you don’t need to implement those resolvers yourself. However, if you would like additional behaviours besides the autogenerated CRUD operations, you can specify custom resolvers for these scenarios.

*A note on custom resolvers*

> Due to the nature of the Cypher generation in this library, you must query any fields used in a custom resolver. For example, in the first example below calculating `fullName`, `firstName` and `lastName` must be included in the selection set whilst querying `fullName`. Without this being the case, `firstName` and `lastName` will be undefined in the custom resolver.

== Custom object type field resolver

If you would like to add a field to an object type which is resolved from existing values in the type, rather than storing new values, you should mark it with an <<type-definitions-access-control-ignore>> directive and define a custom resolver for it.
Expand Down
18 changes: 18 additions & 0 deletions docs/asciidoc/guides/2.0.0-migration/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

[[rel-migration]]
= 2.0.0 Migration

Version 2.0.0 of `@neo4j/graphql` adds support for relationship properties, with some breaking changes to facilitate these new features. All of the required changes will be on the client side, and this guide will walk through what has changed.

== How to Upgrade

Simply update `@neo4j/graphql` using npm or your package manager of choice:

[source, bash]
----
npm update @neo4j/graphql
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this work due to the fact it will be alpha and npm won't push users onto an unstable version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It won't, but I've written it in the tense of "we've released 2.0.0 stable" so that it's ready to merge into master whenever we are. Do you think that will be fine?

----

From this point on, it is primarily Mutations which will form the bulk of the migration:

1. <<rel-migration-mutations>> for how you need to change your Mutations to work with the new schema
Loading