Commit Graph

209 Commits

Author SHA1 Message Date
Brian Clozel
2be79c2c73 Remove configuration key for GraphQL schema path
Currently, the GraphQL schema is exposed under /graphql/schema (so
relative to the main graphql endpoint) and is configurable with the
`spring.graphql.schema.printer.path` configuration property.

We think we should make the schema location more consistent to help
tools and various Gateway products. Also, we don't see right now a
strong use case for such a configuration property.

This commit removes the configuration property and sets the schema
location under `/graphql/schema`(`/graphql` being the main graphql path
configured by the application).

Closes gh-79
2021-07-02 13:57:36 +02:00
Rossen Stoyanchev
9a23e5f8d3 Restructure reference documentation
This commits sets the structure in place, moves the existing content
into its appropriate place, plus further updates to that content.

See gh-78
2021-07-02 12:47:12 +01:00
Rossen Stoyanchev
f17ae9307c Extract schema handling and move into main spring-graphql module 2021-07-02 10:25:18 +01:00
Rossen Stoyanchev
4740696ebf Move GraphiQl handlers to main spring-graphql module 2021-07-02 10:01:10 +01:00
Rossen Stoyanchev
9178075da5 Return 405 "Allow:POST" for HTTP GET queries
See gh-70
2021-07-01 15:48:55 +01:00
Brian Clozel
e3be107f96 Upgrade to Gradle 7.1 2021-07-01 09:50:20 +02:00
Brian Clozel
4333ab603a Fix links in READMEs 2021-07-01 09:48:24 +02:00
Brian Clozel
97a651e4ce Move Javadoc from "javadoc-api" to "api" folder 2021-07-01 09:18:32 +02:00
Brian Clozel
46f210b9d1 Polish documentation 2021-07-01 09:13:19 +02:00
Hantsy Bai
050480fcd6 fix links 2021-07-01 08:39:55 +02:00
Brian Clozel
ef0fe03fce Scan schema locations for well-known file extensions
This commit improves gh-56 to scan schema locations for more well-known
file extensions, as previously only `*.graphqls` was supported.
We're now scanning for `*.graphqls`, `*.gqls`, `*.graphql`, `*.gql`.

Closes gh-56
2021-06-30 21:06:17 +02:00
Brian Clozel
6e871a790b Rename docs artifact 2021-06-30 18:34:57 +02:00
Brian Clozel
34355051b5 Rename docs module
This commit renames the docs module to "spring-graphql-docs" to better
align with other Spring projects and their published docs artifact.
2021-06-30 18:16:27 +02:00
Brian Clozel
e8d8122d76 Remove duplicate reference documentation
Now that the reference documentation has been moved to its proper
toolchain, we can remove its former copy from the README file.

See gh-76
2021-06-30 17:59:45 +02:00
Brian Clozel
818396fce4 Add Spring Code Of Conduct 2021-06-30 17:59:45 +02:00
Brian Clozel
1727c7270a Set up reference documentation and JavaDoc
Closes gh-76
2021-06-30 17:59:45 +02:00
Stephane Nicoll
a1e8571853 Harmonize copyright header 2021-06-30 15:44:24 +02:00
Stephane Nicoll
9d4ebfe743 Polish 2021-06-30 15:44:24 +02:00
Stephane Nicoll
4a1ee14f88 Add default value for "spring.graphql.locations" 2021-06-30 15:44:24 +02:00
Brian Clozel
fdf446f3e6 Load multiple GraphQL schema files
Prior to this commit, the `spring.graphql.schema.location` would only
allow a single file as the source for the GraphQL schema.

This commit changes this configuration to
`spring.graphql.schema.locations` so that it accepts actual locations
(folders) and scans for `*.graphqls` files in those locations. All files
are parsed and merged as a single GraphQL `TypeDefinitionRegistry`.

Closes gh-56
2021-06-29 21:27:18 +02:00
Brian Clozel
f29c5ba764 Fix metadata in published artifacts 2021-06-29 16:39:43 +02:00
Brian Clozel
6dd5595f1e Add Milestone releases CI pipeline 2021-06-29 16:34:14 +02:00
Rossen Stoyanchev
bbf152a32f Deserialize errorType from extensions
The errorType field on GraphQLError is specific to GraphQL Java and when
serialized via GraphqlErrorHelper#toSpecification it becomes an
extension with the key "classification".

This commit ensures that we correctly deserialize back to errorType from
the "classification" extension but unfortunately that's limited to the
ErrorClassification enums that we know of.
2021-06-29 14:53:50 +01:00
Brian Clozel
71ce400e4f Upgrade CI pipeline and images 2021-06-29 15:40:51 +02:00
Rossen Stoyanchev
46221c6d17 Adjust mock expectations for QuerydslDataFetcher
See gh-71
2021-06-29 14:33:00 +01:00
Brian Clozel
eef61843d3 Add property for GraphiQL UI path
This commit adds a new `spring.graphql.graphiql.path` configuration
property for setting the path to the GraphiQL UI page.

This change requires updates in the static HTML page to link the
JavaScript fetcher back to the actual GraphQL API endpoint.

Closes gh-70
2021-06-29 13:52:08 +02:00
Rossen Stoyanchev
9a4da366aa Use fallback default predicate for QuerydslDataFetcher
Closes gh-71
2021-06-29 11:52:09 +01:00
Rob Winch
dfebb6f53d webmvc-http-security uses WebGraphQlTester
Issue gh-58
2021-06-28 15:40:45 -05:00
Rob Winch
7d854dbf47 Add webmvc-http-security
Closes gh-58
2021-06-28 14:17:16 -05:00
Rossen Stoyanchev
5822f7d357 Add @Nullable to TestGraphQlError 2021-06-27 21:51:05 +01:00
Rossen Stoyanchev
0b71596aa5 Global error filter in GraphQlTester.Builder
See gh-66
2021-06-27 21:50:37 +01:00
Rossen Stoyanchev
5cd1e266b4 Parameterize GraphQlTester.RequestSpec
This ensures that the order in which inputs are provided, i.e. whether
taken from the base RequestSpec or the Web subtype doesn't matter.

See gh-64
2021-06-27 21:50:00 +01:00
Rossen Stoyanchev
56ccaf685b GraphQlTester and WebGraphQlTester builders
Closes gh-66
2021-06-27 21:49:40 +01:00
Rossen Stoyanchev
4a6c718394 WebGraphQlTester supports HTTP header input
Closes gh-64
2021-06-26 17:48:30 +01:00
Rossen Stoyanchev
410948bde3 Undo more auto-formatting changes 2021-06-26 17:48:00 +01:00
Rossen Stoyanchev
ed767d1a70 Polishing webflux-security 2021-06-26 05:16:45 +01:00
Rossen Stoyanchev
de234c94c4 Decouple GraphQlTester from Web details
Closes gh-65
2021-06-26 05:16:35 +01:00
Rossen Stoyanchev
17bf9ee287 Polishing
Closes gh-59
2021-06-24 21:13:14 +01:00
Mark Paluch
2d53fdc73f Spring Data repositories that support Querydsl
Spring Data repositories that support Querydsl are now supported
as DataFetchers returning single objects and iterables including
projection support.

See gh-59
2021-06-24 21:13:14 +01:00
Rossen Stoyanchev
ab99dc2892 Improve ThreadLocal value handling
ThreadLocal values from a Servlet container thread maybe end up being
unnecessarily restored, e.g. if DataFetcher is invoked on the same
thread and then also removed, which then impacts the filter chain.

The ContextManager now saves the thread id when values are extracted
and ignores restore or remove calls if still on the same thread. This
should also be more optimal, avoiding ThreadLocal access if threads
aren't switched.

See gh-58
2021-06-24 17:15:19 +01:00
Rob Winch
52572c91b0 SecurityDataFetcherExceptionResolver.setAuthenticationTrustResolver 2021-06-22 15:33:04 -05:00
Rob Winch
4aed51438a SecurityDataFetcherExceptionResolver handles AuthenticationException
This is unlikely to happen as authentication happens prior to reaching
the GraphQL APIs. However, a user may decide to implement security within
GraphQL as it is possible to do through a Spring Controller.
2021-06-22 15:32:38 -05:00
Rossen Stoyanchev
cedb5fb40d Apply context to all exception resolvers
This is more consistent with DataFetcher's, it less brittle, and a
no-op where there is no ThreadLocal context.
2021-06-18 18:34:03 +01:00
Rossen Stoyanchev
efa585b887 Refine and clarify contracts for context management
Use ThreadLocalAccessor, the main API for ThreadLocal value management,
to state where this is supported, which is in Spring MVC, GraphQL
applications.

Improve Javadoc in related contracts as well including a minor
refactoring in ContextManager.
2021-06-18 18:07:05 +01:00
Brian Clozel
57fb7c59f5 Fix build and disable jjavaformat + checkstyle
Right now the Spring JavaFormat and Checkstyle arrangement doesn't work
for the Spring GraphQL source code.

This commit disables the dedicated Gradle conventions until we find a
better solution.
2021-06-16 12:13:35 +02:00
Rossen Stoyanchev
0ce48dc978 Turn off auto-formatting in Boot starter tests 2021-06-16 10:59:28 +01:00
Brian Clozel
16209d8d56 Merge pull request #57 from schauder/fix-schema-location
Correct location of schema in README.
2021-06-16 11:58:58 +02:00
Jens Schauder
ec9f3dd310 Correct location of schema in README. 2021-06-16 11:22:19 +02:00
Rossen Stoyanchev
43f9e34c81 Turn off auto-formatting where it reduces readability 2021-06-15 14:01:52 +01:00
Rossen Stoyanchev
a5f56ca3cb Update README.md 2021-06-09 19:33:11 +01:00