Closed marshall007 closed 5 years ago
I think it would be better for GlobalIDPlugin
to accept an options object, with a key that represents deprecating these fields.
Actually; I think it would be better to not pass the options to GlobalIDPlugin
directly, but instead to use the graphileBuildOptions
interface that all plugins have access to. Settings there will be passed as the second argument to the plugin (const plugin: Plugin = (builder, options) => {...}
)
@benjie made updates based on your feedback.
I've split the schema tests up into their own separate files; this allows easy diffing of them, e.g.
diff -ru schema-base.test.ts.snap schema-default-deprecations.test.ts.snap
--- schema-base.test.ts.snap 2019-05-03 17:33:58.000000000 +0100
+++ schema-default-deprecations.test.ts.snap 2019-05-03 17:33:58.000000000 +0100
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Schema matches snapshot 1`] = `
+exports[`Schema matches snapshot - default deprecations 1`] = `
"\\"\\"\\"All input for the create \`Item\` mutation.\\"\\"\\"
input CreateItemInput {
\\"\\"\\"
@@ -279,7 +279,7 @@
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
\\"\\"\\"
nodeId: ID!
- id: Int!
+ id: Int! @deprecated(reason: \\"Prefer using the Relay global identifier property \`nodeId\` instead.\\")
personOrganizationId: Int!
personIdentifier: String!
label: String!
@@ -512,7 +512,7 @@
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
\\"\\"\\"
nodeId: ID!
- id: Int!
+ id: Int! @deprecated(reason: \\"Prefer using the Relay global identifier property \`nodeId\` instead.\\")
name: String!
createdAt: Datetime!
@@ -677,7 +677,7 @@
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
\\"\\"\\"
nodeId: ID!
- organizationId: Int!
+ organizationId: Int! @deprecated(reason: \\"Prefer using the Relay global identifier property \`organizationByOrganizationId.nodeId\` instead.\\")
identifier: String!
name: String!
createdAt: Datetime!
diff -ru schema-base.test.ts.snap schema-custom-deprecations.test.ts.snap
--- schema-base.test.ts.snap 2019-05-03 17:33:58.000000000 +0100
+++ schema-custom-deprecations.test.ts.snap 2019-05-03 17:33:58.000000000 +0100
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Schema matches snapshot 1`] = `
+exports[`Schema matches snapshot - configured deprecations 1`] = `
"\\"\\"\\"All input for the create \`Item\` mutation.\\"\\"\\"
input CreateItemInput {
\\"\\"\\"
@@ -279,7 +279,7 @@
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
\\"\\"\\"
nodeId: ID!
- id: Int!
+ id: Int! @deprecated(reason: \\"Deprecated\\")
personOrganizationId: Int!
personIdentifier: String!
label: String!
@@ -512,7 +512,7 @@
A globally unique identifier. Can be used in various places throughout the system to identify this single value.
\\"\\"\\"
nodeId: ID!
- id: Int!
+ id: Int! @deprecated(reason: \\"Deprecated\\")
name: String!
createdAt: Datetime!
If I had more time I might snapshot the diffs themselves but 🤷♂
Fixes #3