bx-graphql 0.3.0

Released .

CRUD from a bean

@graphqlCrud( "WidgetService" ) on a bean generates a field for each of get, list, save and delete that service has: widget( id ), widgets, saveWidget( input ) and deleteWidget( id ). @graphqlCrudNames( "list=people" ) renames them. See CRUD from a bean in the README.

  • Paging — parameters of the service's list() named limit and offset become Int arguments of the list field.
  • Two classes under servicePaths with the name a @graphqlCrud gives fail at construction time.

Safer in front of untrusted clients

  • Query limits — maxQueryDepth and maxQueryComplexity refuse an oversized query before any resolver runs.
  • Introspection toggle — introspection : false refuses __schema and __type.
  • Error masking — maskErrors : true tells clients Internal server error when a resolver throws; a function decides which messages pass. onError still receives the real exception.
  • Guards on properties and hand-written resolvers — @graphqlRequires now works on a bean's properties and on methods of {Type}Resolver.bx classes.

Also new

  • operationName — a fourth argument to execute(), for a document holding several operations.
  • handle( body, context ) — runs a GraphQL-over-HTTP request body, as a struct or JSON text; a body that can't be run comes back as an entry in errors.

Changed

  • @graphqlRequires on a bean's class now covers its properties as well as its @graphqlField functions.
  • The app's context travels in graphql-java's GraphQLContext. The context argument is unchanged, but env.getContext() no longer returns it: use the argument, or env.getGraphQlContext().get( "bxgraphql.context" ).

Housekeeping

  • MIT LICENSE file, and a GitHub Actions workflow that runs the specs on every push and pull request.