From d200740e3ec0f39294f79fc5d8e4c29f390a497f Mon Sep 17 00:00:00 2001 From: dondonz <13839920+dondonz@users.noreply.github.com> Date: Sat, 29 Mar 2025 11:57:36 +1100 Subject: [PATCH] Prepare for v23 --- documentation/getting-started.mdx | 6 +- docusaurus.config.js | 2 +- .../{version-v22 => version-v23}/batching.md | 0 .../{version-v22 => version-v23}/concerns.md | 0 .../contributions.md | 0 .../data-fetching.md | 84 +++++++++---------- .../data-mapping.md | 0 .../directives.md | 4 +- .../exceptions.md | 0 .../{version-v22 => version-v23}/execution.md | 0 .../field-selection.md | 0 .../field-visibility.md | 0 .../getting-started.mdx | 6 +- .../instrumentation.md | 0 .../{version-v22 => version-v23}/limits.md | 0 .../{version-v22 => version-v23}/relay.md | 0 .../{version-v22 => version-v23}/scalars.md | 0 .../{version-v22 => version-v23}/schema.md | 0 .../subscriptions.md | 0 .../upgrade-notes.md | 2 +- ...idebars.json => version-v23-sidebars.json} | 2 +- versions.json | 2 +- 22 files changed, 54 insertions(+), 54 deletions(-) rename versioned_docs/{version-v22 => version-v23}/batching.md (100%) rename versioned_docs/{version-v22 => version-v23}/concerns.md (100%) rename versioned_docs/{version-v22 => version-v23}/contributions.md (100%) rename versioned_docs/{version-v22 => version-v23}/data-fetching.md (73%) rename versioned_docs/{version-v22 => version-v23}/data-mapping.md (100%) rename versioned_docs/{version-v22 => version-v23}/directives.md (99%) rename versioned_docs/{version-v22 => version-v23}/exceptions.md (100%) rename versioned_docs/{version-v22 => version-v23}/execution.md (100%) rename versioned_docs/{version-v22 => version-v23}/field-selection.md (100%) rename versioned_docs/{version-v22 => version-v23}/field-visibility.md (100%) rename versioned_docs/{version-v22 => version-v23}/getting-started.mdx (95%) rename versioned_docs/{version-v22 => version-v23}/instrumentation.md (100%) rename versioned_docs/{version-v22 => version-v23}/limits.md (100%) rename versioned_docs/{version-v22 => version-v23}/relay.md (100%) rename versioned_docs/{version-v22 => version-v23}/scalars.md (100%) rename versioned_docs/{version-v22 => version-v23}/schema.md (100%) rename versioned_docs/{version-v22 => version-v23}/subscriptions.md (100%) rename versioned_docs/{version-v22 => version-v23}/upgrade-notes.md (98%) rename versioned_sidebars/{version-v22-sidebars.json => version-v23-sidebars.json} (67%) diff --git a/documentation/getting-started.mdx b/documentation/getting-started.mdx index 1c9c57d..a8deeaf 100644 --- a/documentation/getting-started.mdx +++ b/documentation/getting-started.mdx @@ -25,7 +25,7 @@ repositories { } dependencies { - implementation 'com.graphql-java:graphql-java:22.3' + implementation 'com.graphql-java:graphql-java:23.0' } ``` @@ -38,7 +38,7 @@ repositories { } dependencies { - implementation("com.graphql-java:graphql-java:22.3") + implementation("com.graphql-java:graphql-java:23.0") } ``` @@ -51,7 +51,7 @@ Dependency: com.graphql-java graphql-java - 22.3 + 23.0 ``` diff --git a/docusaurus.config.js b/docusaurus.config.js index 348eea2..5c399f4 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -25,7 +25,7 @@ const config = { routeBasePath: 'documentation', sidebarPath: require.resolve('./sidebars.js'), editUrl: 'https://github.com/graphql-java/graphql-java-page/edit/master/', - lastVersion: "v22", + lastVersion: "v23", versions: { current: { label: "master", diff --git a/versioned_docs/version-v22/batching.md b/versioned_docs/version-v23/batching.md similarity index 100% rename from versioned_docs/version-v22/batching.md rename to versioned_docs/version-v23/batching.md diff --git a/versioned_docs/version-v22/concerns.md b/versioned_docs/version-v23/concerns.md similarity index 100% rename from versioned_docs/version-v22/concerns.md rename to versioned_docs/version-v23/concerns.md diff --git a/versioned_docs/version-v22/contributions.md b/versioned_docs/version-v23/contributions.md similarity index 100% rename from versioned_docs/version-v22/contributions.md rename to versioned_docs/version-v23/contributions.md diff --git a/versioned_docs/version-v22/data-fetching.md b/versioned_docs/version-v23/data-fetching.md similarity index 73% rename from versioned_docs/version-v22/data-fetching.md rename to versioned_docs/version-v23/data-fetching.md index f93a4e7..220275b 100644 --- a/versioned_docs/version-v22/data-fetching.md +++ b/versioned_docs/version-v23/data-fetching.md @@ -42,19 +42,19 @@ It might look like the following : ```java DataFetcher productsDataFetcher = new DataFetcher>() { - @Override - public List get(DataFetchingEnvironment environment) { - DatabaseSecurityCtx ctx = environment.getGraphQlContext().get("databaseSecurityCtx"); - - List products; - String match = environment.getArgument("match"); - if (match != null) { - products = fetchProductsFromDatabaseWithMatching(ctx, match); - } else { - products = fetchAllProductsFromDatabase(ctx); + @Override + public List get(DataFetchingEnvironment environment) { + DatabaseSecurityCtx ctx = environment.getGraphQlContext().get("databaseSecurityCtx"); + + List products; + String match = environment.getArgument("match"); + if (match != null) { + products = fetchProductsFromDatabaseWithMatching(ctx, match); + } else { + products = fetchAllProductsFromDatabase(ctx); + } + return products; } - return products; - } }; ``` @@ -80,25 +80,25 @@ argument. We can have the ProductDTO have logic that applies this date formatti ```java class ProductDTO { - private ID id; - private String name; - private String description; - private Double cost; - private Double tax; - private LocalDateTime launchDate; + private ID id; + private String name; + private String description; + private Double cost; + private Double tax; + private LocalDateTime launchDate; - // ... + // ... - public String getName() { - return name; - } + public String getName() { + return name; + } - // ... + // ... - public String getLaunchDate(DataFetchingEnvironment environment) { - String dateFormat = environment.getArgument("dateFormat"); - return yodaTimeFormatter(launchDate,dateFormat); - } + public String getLaunchDate(DataFetchingEnvironment environment) { + String dateFormat = environment.getArgument("dateFormat"); + return yodaTimeFormatter(launchDate,dateFormat); + } } ``` @@ -135,32 +135,32 @@ Every data fetcher is passed a ``graphql.schema.DataFetchingEnvironment`` object and what arguments have been provided. Here are some of the more interesting parts of ``DataFetchingEnvironment``. * `` T getSource()`` - the ``source`` object is used to get information for a field. Its the object that is the result - of the parent field fetch. In the common case it is an in memory DTO object and hence simple POJO getters will be used for fields values. In more complex cases, you may examine it to know - how to get the specific information for the current field. As the graphql field tree is executed, each returned field value - becomes the ``source`` object for child fields. +of the parent field fetch. In the common case it is an in memory DTO object and hence simple POJO getters will be used for fields values. In more complex cases, you may examine it to know +how to get the specific information for the current field. As the graphql field tree is executed, each returned field value +becomes the ``source`` object for child fields. * `` T getRoot()`` - this special object is used to seed the graphql query. The ``root`` and the ``source`` is the same thing for the - top level fields. The root object never changes during the query and it may be null and hence no used. +top level fields. The root object never changes during the query and it may be null and hence no used. * ``Map getArguments()`` - this represents the arguments that have been provided on a field and the values of those - arguments that have been resolved from passed in variables, AST literals and default argument values. You use the arguments - of a field to control what values it returns. +arguments that have been resolved from passed in variables, AST literals and default argument values. You use the arguments +of a field to control what values it returns. * `` T getGraphQLContext()`` - the context object is set up when the query is first executed and stays the same over the lifetime - of the query. The context is a map that can contain any value and is typically used to give each data fetcher some calling context needed - when trying to get field data. For example the current user credentials or the database connection parameters could be contained - with a context object so that data fetchers can make business layer calls. One of the key design decisions you have as a graphql - system designer is how you will use context in your fetchers if at all. Some people use a dependency framework that injects context into - data fetchers automatically and hence don't need to use this. +of the query. The context is a map that can contain any value and is typically used to give each data fetcher some calling context needed +when trying to get field data. For example the current user credentials or the database connection parameters could be contained +with a context object so that data fetchers can make business layer calls. One of the key design decisions you have as a graphql +system designer is how you will use context in your fetchers if at all. Some people use a dependency framework that injects context into +data fetchers automatically and hence don't need to use this. * ``ExecutionStepInfo getExecutionStepInfo()`` - the field type information is a catch all bucket of field type information that is built up as - the query is executed. The following section explains more on this. +the query is executed. The following section explains more on this. * ``DataFetchingFieldSelectionSet getSelectionSet()`` - the selection set represents the child fields that have been "selected" under neath the - currently executing field. This can be useful to help look ahead to see what sub field information a client wants. The following section explains more on this. +currently executing field. This can be useful to help look ahead to see what sub field information a client wants. The following section explains more on this. * ``ExecutionId getExecutionId()`` - each query execution is given a unique id. You can use this perhaps on logs to tag each individual - query. +query. ## The interesting parts of ExecutionStepInfo @@ -182,7 +182,7 @@ query { name description sellingLocations { - state + state } } } diff --git a/versioned_docs/version-v22/data-mapping.md b/versioned_docs/version-v23/data-mapping.md similarity index 100% rename from versioned_docs/version-v22/data-mapping.md rename to versioned_docs/version-v23/data-mapping.md diff --git a/versioned_docs/version-v22/directives.md b/versioned_docs/version-v23/directives.md similarity index 99% rename from versioned_docs/version-v22/directives.md rename to versioned_docs/version-v23/directives.md index b7529dd..53079dc 100644 --- a/versioned_docs/version-v22/directives.md +++ b/versioned_docs/version-v23/directives.md @@ -9,7 +9,7 @@ description: How SDL Directives can be used to adjust the behavior of your graph There are two broad categories of directives, schema and operation directives. Schema directives are used on schema elements, and operation directives are used in operations within a GraphQL document. -Often, operation directives are also called "query directives", although they can be used in any GraphQL operation. Whilst both names can be used interchangeably, note that GraphQL Java class names use "query directives". +Often, operation directives are also called "query directives", although they can be used in any GraphQL operation. Whilst both names can be used interchangeably, note that GraphQL Java class names use "query directives". Note for those who love the details: the terminology of directives is a bit confusing. It is technically possible to define a directive that is both a schema and operation directive, in other words, defined for both schema and operation locations. However in practice, this is not common. @@ -310,7 +310,7 @@ When the above was executed each directive would be applied one on top of the ot to preserve the previous data fetcher to retain behaviour (unless of course you mean to throw it away) # Operation Directives (also known as Query Directives) -Let's define an operation directive `@cache`, which can be used on operation fields. +Let's define an operation directive `@cache`, which can be used on operation fields. ```graphql # Can only be used on a field in a GraphQL document diff --git a/versioned_docs/version-v22/exceptions.md b/versioned_docs/version-v23/exceptions.md similarity index 100% rename from versioned_docs/version-v22/exceptions.md rename to versioned_docs/version-v23/exceptions.md diff --git a/versioned_docs/version-v22/execution.md b/versioned_docs/version-v23/execution.md similarity index 100% rename from versioned_docs/version-v22/execution.md rename to versioned_docs/version-v23/execution.md diff --git a/versioned_docs/version-v22/field-selection.md b/versioned_docs/version-v23/field-selection.md similarity index 100% rename from versioned_docs/version-v22/field-selection.md rename to versioned_docs/version-v23/field-selection.md diff --git a/versioned_docs/version-v22/field-visibility.md b/versioned_docs/version-v23/field-visibility.md similarity index 100% rename from versioned_docs/version-v22/field-visibility.md rename to versioned_docs/version-v23/field-visibility.md diff --git a/versioned_docs/version-v22/getting-started.mdx b/versioned_docs/version-v23/getting-started.mdx similarity index 95% rename from versioned_docs/version-v22/getting-started.mdx rename to versioned_docs/version-v23/getting-started.mdx index 1c9c57d..a8deeaf 100644 --- a/versioned_docs/version-v22/getting-started.mdx +++ b/versioned_docs/version-v23/getting-started.mdx @@ -25,7 +25,7 @@ repositories { } dependencies { - implementation 'com.graphql-java:graphql-java:22.3' + implementation 'com.graphql-java:graphql-java:23.0' } ``` @@ -38,7 +38,7 @@ repositories { } dependencies { - implementation("com.graphql-java:graphql-java:22.3") + implementation("com.graphql-java:graphql-java:23.0") } ``` @@ -51,7 +51,7 @@ Dependency: com.graphql-java graphql-java - 22.3 + 23.0 ``` diff --git a/versioned_docs/version-v22/instrumentation.md b/versioned_docs/version-v23/instrumentation.md similarity index 100% rename from versioned_docs/version-v22/instrumentation.md rename to versioned_docs/version-v23/instrumentation.md diff --git a/versioned_docs/version-v22/limits.md b/versioned_docs/version-v23/limits.md similarity index 100% rename from versioned_docs/version-v22/limits.md rename to versioned_docs/version-v23/limits.md diff --git a/versioned_docs/version-v22/relay.md b/versioned_docs/version-v23/relay.md similarity index 100% rename from versioned_docs/version-v22/relay.md rename to versioned_docs/version-v23/relay.md diff --git a/versioned_docs/version-v22/scalars.md b/versioned_docs/version-v23/scalars.md similarity index 100% rename from versioned_docs/version-v22/scalars.md rename to versioned_docs/version-v23/scalars.md diff --git a/versioned_docs/version-v22/schema.md b/versioned_docs/version-v23/schema.md similarity index 100% rename from versioned_docs/version-v22/schema.md rename to versioned_docs/version-v23/schema.md diff --git a/versioned_docs/version-v22/subscriptions.md b/versioned_docs/version-v23/subscriptions.md similarity index 100% rename from versioned_docs/version-v22/subscriptions.md rename to versioned_docs/version-v23/subscriptions.md diff --git a/versioned_docs/version-v22/upgrade-notes.md b/versioned_docs/version-v23/upgrade-notes.md similarity index 98% rename from versioned_docs/version-v22/upgrade-notes.md rename to versioned_docs/version-v23/upgrade-notes.md index 0f93704..def289c 100644 --- a/versioned_docs/version-v22/upgrade-notes.md +++ b/versioned_docs/version-v23/upgrade-notes.md @@ -41,7 +41,7 @@ You can use the `LegacyCoercingInputInterceptor` implementation to monitor traff ```java InputInterceptor legacyInputInterceptor = LegacyCoercingInputInterceptor.observesValues((inputValue, graphQLInputType) -> { - emitAMetric(inputValue, graphQLInputType); + emitAMetric(inputValue, graphQLInputType); }); ExecutionInput executionInput = ExecutionInput.newExecutionInput() diff --git a/versioned_sidebars/version-v22-sidebars.json b/versioned_sidebars/version-v23-sidebars.json similarity index 67% rename from versioned_sidebars/version-v22-sidebars.json rename to versioned_sidebars/version-v23-sidebars.json index 84d9733..27328de 100644 --- a/versioned_sidebars/version-v22-sidebars.json +++ b/versioned_sidebars/version-v23-sidebars.json @@ -1,5 +1,5 @@ { - "version-v22/tutorialSidebar": [ + "version-v23/tutorialSidebar": [ { "type": "autogenerated", "dirName": "." diff --git a/versions.json b/versions.json index 5d9168b..352d66f 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ [ - "v22" + "v23" ]