All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- GraphiQL link to service index HTML page for GraphQL endpoints
- Allow usage of express 5
- Only load default error formatter if no custom error formatter is configured
- Sanitization of logged queries, when running in production, if literal values contain parentheses
- Read GraphiQL HTML file only once on startup, and only if GraphiQL is enabled, to avoid unnecessary file system access
- Server crash by
SyntaxErrorfrom express JSON parser
- Schema validation after schema generation (on server startup or manual compilation) to ensure that the generated schema is valid according to the GraphQL specification
- Scalar type
Voidthat represents the absence of a return value and only allows valuenull
- Improved schema generation robustness where specific CDS modelling could cause empty GraphQL types to be generated (which is not allowed) for entities, aspects and services. These types and any resulting empty parent types are omitted from the generated schema and a warning is logged for them. If schema generation would result in an empty query root type, a placeholder field
_of typeVoidis added to keep the schema valid.
- Bump
@graphiql/plugin-explorerversion to^3 - Make error handling compatible with
@sap/cdsversion>=9 - Bump required
@sap/cdsversion to>=9which will be released in the near future
- Support for configuring request payload limit using global flag
cds.server.body_parser.limit
- Bump required
@sap/cdsversion to>=7.8 - To improve performance, binary payloads are no longer validated to check if they are properly base64 or base64url encoded
- Bump required
nodeversion to^16due to usage ofBuffer.toString('base64url') - Use
cds.compile.to.serviceinfoto determine if a service should be compiled to GraphQL schema
- Type parsing error for literal values passed within arguments on fields of scalar type differing from the literal type. This case occurred for delete mutations when the filter operands had a type other than
Int.
- Support for generating GraphQL descriptions from CDS doc comments of services, entities, and elements
- Support for operator
infor filtering on lists of values
- Bump
@graphiql/plugin-explorerversion to^1 - Ignore fields that represent foreign keys in GraphQL schema generation
- When compiling to GraphQL using the CDS API or CLI, only generate GraphQL schemas for services that are annotated with GraphQL protocol annotations
- Name clashes when CDS elements are named
nodesortotalCount - Parsing of
nullvalues in lists
- Message interpolation of logged errors, transforming error message placeholders into human-readable text (default locale)
- Moved registration of
cds.compile.to.gqlandcds.compile.to.graphqltargets from@sap/cdsto@cap-js/graphql - Improve merging of custom
graphqlprotocol configuration with plugin default configuration - Errors representing client errors (
4xxrange) are now logged as warnings instead of errors - Exclude the stack trace of the outer logged error message in multiple error scenarios, as the inner stack trace already contained the precise initial segment of the outer stack trace
- Load custom
errorFormatterrelative to CDS project root - Fix internal server error when formatting errors that aren't CDS errors (thrown by CDS or in custom handlers) or instances of GraphQLError, such as the error caused by requests with undefined
queryproperty
- [beta] Translate CDS error messages and include additional error properties in
GraphQLErrorextensions. Only specific allowed properties are exposed when running in production. - [beta] Option
errorFormatterthat can be pointed to a function that overwrites the default logic of how CDS errors are formatted before they are added to the GraphQL error response. Please note that this may overwrite sanitization logic that is otherwise applied to error messages in production. - [beta] Logging of errors that occur during query and mutation execution
- Bump required
@sap/cdsversion to>=7.3 - Bump required
graphql-httpversion to^1.18.0
- Malformed responses for convoluted queries in which parts of results are supposed to be returned multiple times, caused by formatting results in-place
- Omit
variablesfrom log if it is an empty object
- Pin
graphiqlversion to^3 - Pin
@graphiql/plugin-explorerversion to~0.3
- GraphiQL Explorer Plugin initialization due to upstream implementation pattern change
- Improved query logging:
- Don't log queries that are
undefined - Log
operationName - Log
variableswhen not in production - Sanitize arguments and their values in queries when in production
- Don't log queries that are
- Changed GraphiQL Explorer Plugin CDN URL due to upstream renaming
- Support for
@sap/cds^7middlewares and protocols. Note: services now need to be annotated with protocol annotations such as@graphqlor@protocol: 'graphql'.
- Bump required
@sap/cdsversion to>=7 @cap-js/graphql/index.jsnow collects individual services and mounts the adapter as a protocol middleware on thecds.on('served', ...)event- Moved the
GraphQLAdaptermodule tolib/GraphQLAdapter.jsand merged it withCDSGraphQLAdapterpreviously found inindex.jsin the root directory - Don't generate fields that represent compositions of aspects within mutation types that represent services
- Disabled conjunction on the same field for the following operators:
eq(Equal)gt(Greater Than)ge(Greater Than or Equal)le(Less Than or Equal)lt(Less Than)startswithendswith
- Improved consistency of handling results of different types returned by custom handlers in CRUD resolvers:
- Wrap only objects (i.e. not primitive types or arrays) returned by custom handlers in arrays in create, read, and update resolvers
- Delete mutations return the length of an array that is returned by a
DELETEcustom handler or 1 if a single object is returned
- Don't generate fields for key elements in update input objects
- Update and delete mutations have mandatory
filterargument - Allow services that are not instances of
cds.ApplicationService. It is expected that the invoker provides the correct set of service providers when directly using the GraphQL protocol adapter API.
- Aligned
cds.Requestinstantiation with other protocols for more consistent usage in custom handlers
cds-plugin.jswas missing infilesproperty ofpackage.json
- Supporting new
cds-plugintechnique for zero configuration - Support for filtering by
nullvalues - Allow multiple filters on the same field, with the same operator, that are logically joined by
AND. For example, filtering for all books with titles that contain both strings, "Wuthering" and "Heights":{ AdminService { Books(filter: { title: { contains: ["Wuthering", "Heights"] } }) { nodes { title } } } }
- Improved handling of
nullandundefinedvalues in query arguments - Empty filter lists resolve to
falseand empty filter objects resolve totrue
- Handling of GraphQL queries that are sent via
GETrequests using thequeryURL parameter if GraphiQL is enabled
- Add
appfolder tofilesproperty ofpackage.jsonto be included for publishing tonpm
- Replaced deprecated GraphQL HTTP server
express-graphqlwithgraphql-http - Serve GraphiQL 2 via included HTML instead of relying on the server framework (
express-graphqlincluded GraphiQL 1) - Bump
graphqlversion to 16 - Execute query resolvers in parallel and mutation resolvers serially
- Register
aliasFieldResolverduring schema generation instead of passing it to the GraphQL server - The filters
contains,startswith, andendswithnow generate CQN function calls instead of generatinglikeexpressions directly
- Schema generation crash that occurred if an entity property is named
localized - The field
totalCountcould not be queried on its own
- To-many relationships are now represented by an additional nesting level which contains the fields
totalCountandnodes.totalCountis similar to OData$count.nodescontains the fields belonging to the entity. This is similar to the GraphQL cursor connection specification, but without an additional secondedgesnesting level. The following shows an example query using the new schema structure:{ AdminService { Books { totalCount nodes { title } } } } - Support for aliases on fields returned by mutations
- Improved support for aliases on fields that represent compositions and associations (some limitations still apply)
- Include localized
textsfields of entities in schema generation - Improve check to skip field
localizedduring schema generation
- The GraphQL protocol adapter now uses a new middlewares mechanism instead of
cds.pluginswhich requires@sap/cdsversion 6.3 to run. Enable thecds.requires.middlewaresflag and register the GraphQL protocol adapter incds.env.protocolsto get started. - Replaced
debuglevel query and mutation logging with improvedinfolevel request logging