From be0288d86ea0263ae1fbcaf11f9af7f6af6d99c4 Mon Sep 17 00:00:00 2001 From: Darrell Warde Date: Fri, 4 Aug 2023 15:47:24 +0100 Subject: [PATCH] Remove references to deprecated directives --- modules/ROOT/pages/introspector.adoc | 2 +- modules/ROOT/pages/ogm/index.adoc | 13 ++- .../pages/reference/directives/index.adoc | 31 ------- .../field-configuration.adoc | 40 --------- .../type-configuration.adoc | 85 ------------------- .../type-definitions/interfaces.adoc | 42 --------- 6 files changed, 10 insertions(+), 203 deletions(-) diff --git a/modules/ROOT/pages/introspector.adoc b/modules/ROOT/pages/introspector.adoc index 7e298361..17e1898b 100644 --- a/modules/ROOT/pages/introspector.adoc +++ b/modules/ROOT/pages/introspector.adoc @@ -13,7 +13,7 @@ This tool has full support for generating type definitions, including: - `@node` - `label` for mapping where a node label might use a character that's not in the GraphQL supported character set - `additionalLabels` for nodes that has multiple labels -- Generating a read-only version of the GraphQL type definitions, i.e. generate a `@exclude(operations: [CREATE, DELETE, UPDATE])` directive on all node types. +- Generating a read-only version of the GraphQL type definitions == Limitations diff --git a/modules/ROOT/pages/ogm/index.adoc b/modules/ROOT/pages/ogm/index.adoc index 42b665c8..63886eee 100644 --- a/modules/ROOT/pages/ogm/index.adoc +++ b/modules/ROOT/pages/ogm/index.adoc @@ -16,11 +16,16 @@ Most applications won't just expose a single GraphQL API. There may also be sche The following directives are excluded from the OGM's schema: -- `@auth` -- `@exclude` +- `@authentication` +- `@authorization` +- `@subscriptionsAuthorization` - `@private` -- `@readonly` -- `@writeonly` +- `@query` +- `@mutation` +- `@subscription` +- `@filterable` +- `@selectable` +- `@settable` This is because the OGM is only ever used programmatically, as opposed to an exposed API which needs these security measures. diff --git a/modules/ROOT/pages/reference/directives/index.adoc b/modules/ROOT/pages/reference/directives/index.adoc index 716cc95e..cece301c 100644 --- a/modules/ROOT/pages/reference/directives/index.adoc +++ b/modules/ROOT/pages/reference/directives/index.adoc @@ -7,11 +7,6 @@ The `@alias` directive will map a GraphQL schema field to a Neo4j property on a Reference: xref::reference/directives/database-mapping.adoc#type-definitions-alias[`@alias`] -== `@auth` -label:deprecated[] - -The `@auth` directive is used to define complex fine-grained and role-based access control for object types and fields. - == `@coalesce` The `@coalesce` directive exposes a mechanism for querying against non-existent, `null` values on a node. @@ -38,16 +33,6 @@ The `@default` directive allows for the setting of a default value for a field o Reference: xref::reference/directives/default-values.adoc#type-definitions-default-values-default[`@default`] -== `@exclude` label:deprecated[] - -This directive is deprecated. - -Use the xref:reference/directives/schema-configuration/type-configuration.adoc#_query[`@query`], xref:reference/directives/schema-configuration/type-configuration.adoc#_mutation[`@mutation`] and the xref:reference/directives/schema-configuration/type-configuration.adoc#_subscription[`@subscription`] directives instead. - -The `@exclude` directive is used on object types to instruct them to be skipped during Query, Mutation and Subscription generation. - -Reference: xref::reference/directives/schema-configuration/type-configuration.adoc#_exclude_deprecated[`@exclude`] - == `@fulltext` The `@fulltext` directive indicates that there should be a Fulltext index inserted into the database for the specified Node and its properties. @@ -106,13 +91,6 @@ The `@queryOptions` is to be used on nodes, where applied will inject values int Reference: xref::reference/directives/default-values.adoc#type-definitions-default-values-queryoptions[`@queryOptions`] -== `@readonly` label:deprecated[] - -This directive is deprecated. See the xref:reference/directives/schema-configuration/field-configuration.adoc#_settable[`@settable`] directive. -The `@readonly` directive marks fields as read-only. - -Reference: xref::reference/directives/schema-configuration/field-configuration.adoc#_readonly_deprecated[`@readonly`] - == `@relationship` The `@relationship` directive is used to configure relationships between object types. @@ -160,12 +138,3 @@ Reference: xref::reference/directives/autogeneration.adoc#type-definitions-autog The `@unique` directive indicates that there should be a uniqueness constraint in the database for the fields that it is applied to. Reference: xref::reference/type-definitions/indexes-and-constraints.adoc#type-definitions-constraints-unique[Unique node property constraints] - -== `@writeonly` label:deprecated[] - -This directive is deprecated. - -Use the xref:reference/directives/schema-configuration/field-configuration.adoc#_selectable[`@selectable`] directive instead. -The `@writeonly` directive marks fields as write-only. - -Reference: xref::reference/directives/schema-configuration/field-configuration.adoc#_writeonly_deprecated[`@writeonly`] diff --git a/modules/ROOT/pages/reference/directives/schema-configuration/field-configuration.adoc b/modules/ROOT/pages/reference/directives/schema-configuration/field-configuration.adoc index 7e7c0b05..a3a2af21 100644 --- a/modules/ROOT/pages/reference/directives/schema-configuration/field-configuration.adoc +++ b/modules/ROOT/pages/reference/directives/schema-configuration/field-configuration.adoc @@ -394,43 +394,3 @@ input ActorUpdateInput { ---- This means the `actedIn` can be updated on an update, but it will not be available on create operations. - -== `@readonly` label:deprecated[] - -With this directive, fields will only be featured in mutations for creating and in object types for querying. -It is not mutable after creation. - -[NOTE] -==== -This directive is deprecated. -Use the xref::reference/directives/schema-configuration/field-configuration.adoc#_settable[`@settable`] directive instead. -==== - - -=== Definition - -[source, graphql, indent=0] ----- -"""Instructs @neo4j/graphql to only include a field in generated input type for creating, and in the object type within which the directive is applied.""" -directive @readonly on FIELD_DEFINITION ----- - - -== `@writeonly` label:deprecated[] - -With this directive, fields will only be featured in input types and will not be available for querying the object type through a Query or through a mutation response. - -[NOTE] -==== -This directive is deprecated. -Use the xref::reference/directives/schema-configuration/field-configuration.adoc#_selectable[`@selectable`] directive instead. -==== - - -=== Definition - -[source, graphql, indent=0] ----- -"""Instructs @neo4j/graphql to only include a field in the generated input types for the object type within which the directive is applied, but exclude it from the object type itself.""" -directive @writeonly on FIELD_DEFINITION ----- diff --git a/modules/ROOT/pages/reference/directives/schema-configuration/type-configuration.adoc b/modules/ROOT/pages/reference/directives/schema-configuration/type-configuration.adoc index 2f421de5..5f659a98 100644 --- a/modules/ROOT/pages/reference/directives/schema-configuration/type-configuration.adoc +++ b/modules/ROOT/pages/reference/directives/schema-configuration/type-configuration.adoc @@ -153,88 +153,3 @@ type Movie @subscription(operations: [CREATE]) { length: Int } ---- - -== `@exclude` label:deprecated[] - -This directive skips the generation of queries and/or subscriptions and/or particular/all mutations for the specified type. - -[NOTE] -==== -This directive is deprecated. - -Use the xref:reference/directives/schema-configuration/type-configuration.adoc#_query[`@query`], xref:reference/directives/schema-configuration/type-configuration.adoc#_mutation[`@mutation`] and the xref:reference/directives/schema-configuration/type-configuration.adoc#_subscription[`@subscription`] directives instead. -==== - -=== Definition - -[source, graphql, indent=0] ----- -enum ExcludeOperation { - CREATE - READ - UPDATE - DELETE - SUBSCRIBE -} - -"""Instructs @neo4j/graphql to exclude the specified operations from query, mutation and subscription generation. If used without an argument, no queries, mutations or subscriptions will be generated for this type.""" -directive @exclude( - operations: [ExcludeOperation!]! = [CREATE, READ, UPDATE, DELETE, SUBSCRIBE] -) on OBJECT ----- - -=== Usage - -==== Disable Query field generation - -[source, graphql, indent=0] ----- -type User @exclude(operations: [READ]) { - name: String -} ----- - -==== Disable single Mutation field generation - -[source, graphql, indent=0] ----- -type User @exclude(operations: [CREATE]) { - name: String -} ----- - -==== Disable multiple Mutation field generation - -[source, graphql, indent=0] ----- -type User @exclude(operations: [CREATE, DELETE]) { - name: String -} ----- - -==== Disable Subscription field generation - -[source, graphql, indent=0] ----- -type User @exclude(operations: [SUBSCRIBE]) { - name: String -} ----- - -==== Disable all Query, Mutation, and Subscription field generation - -The following two type definitions are equivalent in the sense that no queries, mutations, or subscriptions will be generated for either of them: - -[source, graphql, indent=0] ----- -type User @exclude { - name: String -} ----- - -[source, graphql, indent=0] ----- -type User @exclude(operations: [CREATE, READ, UPDATE, DELETE, SUBSCRIBE]) { - name: String -} ----- \ No newline at end of file diff --git a/modules/ROOT/pages/reference/type-definitions/interfaces.adoc b/modules/ROOT/pages/reference/type-definitions/interfaces.adoc index ca45cc57..0ebfdc6f 100644 --- a/modules/ROOT/pages/reference/type-definitions/interfaces.adoc +++ b/modules/ROOT/pages/reference/type-definitions/interfaces.adoc @@ -71,48 +71,6 @@ type Actor { } ---- -==== Overriding - -In addition to inheritance, directives can be overridden on a per-implementation basis. Say you had an interface defining some `Content`, with some basic authorization rules: - -[source, graphql, indent=0] ----- -interface Content - @auth(rules: [{ operations: [CREATE, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) { - title: String! - author: [Author!]! @relationship(type: "HAS_CONTENT", direction: IN) -} - -type User { - username: String! - content: [Content!]! @relationship(type: "HAS_CONTENT", direction: OUT) -} ----- - -You might implement this once for public content and once for private content which has additional rules in place: - -[source, graphql, indent=0] ----- -type PublicContent implements Content { - title: String! - author: [Author!]! -} - -type PrivateContent implements Content - @auth(rules: [{ operations: [CREATE, READ, UPDATE, DELETE], allow: { author: { username: "$jwt.sub" } } }]) { - title: String! - author: [Author!]! -} ----- - -The `PublicContent` type will inherit the auth rules from the `Content` interface, whilst the `PrivateContent` type will use the auth rules specified there. - -In summary, there are three choices for the application of directives when using interfaces: - -- Directives specified on the interface and inherited by all implementing types when the directives for every type are the same. -- Directives specified on the interface and overridden by certain implementing types when directives are broadly the same with a few discrepancies. -- Directives specified on implementing types alone when there is very little commonality between types, or certain types need a directive and others don't. - [[type-definitions-interfaced-types-querying]] == Querying an interface