coldbox-graphql 0.2.0

Released .

Code-first schemas and support for Adobe ColdFusion.

New

  • Code-first schemas. modelPaths and servicePaths build the schema from annotated CFCs:

    • @graphqlType, @graphqlInput and @graphqlEnum classes;
    • @graphqlQuery and @graphqlMutation service functions;
    • @graphqlCrud, which adds the CRUD shapes.

    The annotations can be doc-comment tags or attributes, and the generated schema can be used alongside hand-written .graphqls files or instead of them.

  • Authorization. @graphqlRequires on properties, resolver methods and service functions, checked by settings.authorizer.

  • Batch loaders. settings.loaders, with nothing cached between requests.

  • Interfaces and unions. Resolved through {Type}Resolver.resolveType, then __typename, then the class name.

  • Scalars. DateTime and Long are built in; settings.scalars adds your own as closures.

  • Errors. Errors follow the GraphQL spec's shape, with onError and maskErrors.

  • Limits. maxQueryDepth and maxQueryComplexity.

  • API. execute() and handle() return plain structs.

  • Instances. instanceFactory builds services, resolvers and input beans yourself.

Engines

  • Tested on Lucee 5.4.8.2 and Adobe ColdFusion 2023 (update 26): 138 specs pass on both.
  • The module now runs on ACF, which it did not before.
  • BoxLang apps should use bx-graphql.

Behaviour changes

  • The HTTP endpoint answers 400 when variables isn't an object, and leaves errors out when there are none.
  • resolverBasePackage and schemaPaths are optional when modelPaths or servicePaths is set.
  • A custom scalar that can't serialize a resolver's value fails the whole request, on both engines.