CDS pluginCDS plugintypeInstalls into a CAP project and extends the runtime. CAP loads it through cds.requires or the plugin hook.See every one →What this type is →by SAPby SAPoriginPublished by SAP itself. A visible facet, never an input to a reading — a dormant official plugin reads exactly like a dormant independent one.See every one →

@cap-js/graphql

A protocol adapter that generates a GraphQL schema from the model and serves it, so the same services answer GraphQL without a second definition of them.

Facts

Latestv0.14.0ReleasedLast pushLicenceApache-2.0

Where it sits

Lives in
Provides
GraphQLCAPGraphQLcapabilityServing the same model over GraphQL instead of OData — one endpoint, the client naming the fields it wants, for consumers who expect that shape rather than an OData one.
Flavors
Requires
@sap/cds≥ 9@sap/cdsartifactThe peer range, as published.

Who is behind it

SAP Cloud Application Programming ModelSAP Cloud Application Programming ModelOrganisationMaintains this
In the atlas: maintains 34
@cap-js
maintainerAjinkya PatilPersonContributes to this
In the atlas: contributes to 112
@ajinkyapatil8190
Arley Triana MorinPersonContributes to this
In the atlas: contributes to 9, wrote 1
@arleytm
Christian GeorgiPersonContributes to this
In the atlas: maintains 1, contributes to 53
@chgeo
Christian NeuPersonContributes to this
In the atlas: contributes to 5
@christianneu
Christian SchüringsPersonContributes to this
In the atlas: contributes to 25
@cschuerings
Daniel HutzelPersonContributes to this
In the atlas: contributes to 32, wrote 3
@danjoa
Dr. David A. KunzPersonContributes to this
In the atlas: contributes to 16
@David-Kunz
OlenaPersonContributes to this
In the atlas: contributes to 11
@etimr
Heiko WitteborgPersonContributes to this
In the atlas: contributes to 18
@hm23
Johannes VogelPersonContributes to this
In the atlas: contributes to 25
@johannes-vogel
22 contributors

Before choosing this

Conditions

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2, 3A cds-plugin is used with SAP CAP materials, or an artifact is explicitly identified as a CAP plugin or application.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.
  • § 3 Artificial Intelligence Training. The agreement prohibits use of the covered materials and customer applications for training artificial-intelligence models or systems.
SAP Developer License Agreement 3.2 CAP →

What it declares

Every artifact

Type
CDS plugin
Origin
By SAP

As a CDS plugin

Declared for
>=9
Distributed through
npm

Connections1

Install

npm add @cap-js/graphql

Derived from the package name. No recipe recorded; the README has the configuration.

Learn more2

Readings
  1. SAP CAPv7 - Node.js Highlights and Experiencesdavidtill, SAP Community
  2. CAP: GraphQL as new protocoljhodel18, SAP Community

README

quoted from cap-js/graphql under Apache-2.0, read
cap-js/graphql/README.mdOn GitHub

REUSE status

CDS protocol adapter for GraphQL

About this project

A GraphQL protocol adapter for SAP Cloud Application Programming Model Node.js. This adapter generically generates a GraphQL schema for the models of an application and serves an endpoint that allows you to query your services using the GraphQL query language.

WARNING: This package is in an early general availability state. This means that it is generally available, with stable APIs unless otherwise indicated, and you can use it for production. However, please note the current limitations listed below.

Requirements and Setup

  1. Simply add the GraphQL adapter to your project using npm:
    npm add @cap-js/graphql

This command will set up the GraphQL plug-in with the @sap/cds runtime. It enables the new middlewares architecture in Node.js and registers a GraphQL endpoint at /graphql serving all CRUD requests for the application services found in your model.

  1. Annotate the services you want to serve, e.g. using @graphql or @protocol: 'graphql'.

  2. Run your server as usual, e.g. using cds watch.

The runtime will serve all annotated services via GraphQL at the default configured endpoint.

Limitations

  • Actions and functions are not yet supported.
  • CDS annotations like @readonly aren’t considered during schema generation.
  • Cursor-based Pagination – we currently support offset-based pagination, and will add cursor-based pagination going forward. While we intend to support both variants then, it is not guaranteed that we can do so without breaking changes to current behaviour.
  • Extensions are not yet considered.

Support, Feedback, Contributing

This project is open to feature requests/suggestions, bug reports etc. via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.

Code of Conduct

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.

Licensing

Copyright 2022 SAP SE or an SAP affiliate company and cap-js/graphql contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.

Apache-2.0, read

History

Latest

v0.14.0

Changed 1, Fixes 3

Notes
Changed
  • Only load default error formatter if no custom error formatter is configured
Fixed
  • 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 SyntaxError from express JSON parser
  1. v0.13.0

    Features 2, Fixes 1

    Notes
    Added
    • 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 Void that represents the absence of a return value and only allows value null
    Fixed
    • 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 type Void is added to keep the schema valid.
  2. v0.12.0

    Changed 3

    Notes
    Changed
    • Bump @graphiql/plugin-explorer version to ^3
    • Make error handling compatible with @sap/cds version >=9
    • Bump required @sap/cds version to >=9 which will be released in the near future
  3. v0.11.0

    Features 1, Changed 4

    Notes
    Added
    • Support for configuring request payload limit using global flag cds.server.body_parser.limit
    Changed
    • Bump required @sap/cds version to >=7.8
    • To improve performance, binary payloads are no longer validated to check if they are properly base64 or base64url encoded
    • Bump required node version to ^16 due to usage of Buffer.toString('base64url')
    • Use cds.compile.to.serviceinfo to determine if a service should be compiled to GraphQL schema
  4. v0.10.1

    Fixes 1

    Notes
    Fixed
    • 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.
  5. v0.10.0

    Features 2, Changed 3, Fixes 2

    Notes
    Added
    • Support for generating GraphQL descriptions from CDS doc comments of services, entities, and elements
    • Support for operator in for filtering on lists of values
    Changed
    • Bump @graphiql/plugin-explorer version 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
    Fixed
    • Name clashes when CDS elements are named nodes or totalCount
    • Parsing of null values in lists
  6. v0.9.0

    Features 1, Changed 4, Fixes 2

    Notes
    Added
    • Message interpolation of logged errors, transforming error message placeholders into human-readable text (default locale)
    Changed
    • Moved registration of cds.compile.to.gql and cds.compile.to.graphql targets from @sap/cds to @cap-js/graphql
    • Improve merging of custom graphql protocol configuration with plugin default configuration
    • Errors representing client errors (4xx range) 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
    Fixed
    • Load custom errorFormatter relative 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 query property
  7. v0.8.0

    Features 3, Changed 2, Fixes 1

    Notes
    Added
    • [beta] Translate CDS error messages and include additional error properties in GraphQLError extensions. Only specific allowed properties are exposed when running in production.
    • [beta] Option errorFormatter that 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
    Changed
    • Bump required @sap/cds version to >=7.3
    • Bump required graphql-http version to ^1.18.0
    Fixed
    • Malformed responses for convoluted queries in which parts of results are supposed to be returned multiple times, caused by formatting results in-place
  8. v0.7.0

    Changed 1

    Notes
    Changed
    • Omit variables from log if it is an empty object
  9. v0.6.2

    Changed 2, Fixes 1

    Notes
    Changed
    • Pin graphiql version to ^3
    • Pin @graphiql/plugin-explorer version to ~0.3
    Fixed
    • GraphiQL Explorer Plugin initialization due to upstream implementation pattern change
  10. v0.6.1

    Changed 1, Fixes 1

    Notes
    Changed
    • Improved query logging:
      • Don't log queries that are undefined
      • Log operationName
      • Log variables when not in production
      • Sanitize arguments and their values in queries when in production
    Fixed
    • Changed GraphiQL Explorer Plugin CDN URL due to upstream renaming
  11. v0.6.0

    Features 1, Changed 5

    Notes
    Added
    • Support for @sap/cds^7 middlewares and protocols. Note: services now need to be annotated with protocol annotations such as @graphql or @protocol: 'graphql'.
    Changed
    • Bump required @sap/cds version to >=7
    • @cap-js/graphql/index.js now collects individual services and mounts the adapter as a protocol middleware on the cds.on('served', ...) event
    • Moved the GraphQLAdapter module to lib/GraphQLAdapter.js and merged it with CDSGraphQLAdapter previously found in index.js in 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)
      • startswith
      • endswith
  12. v0.5.0

    Changed 4, Fixes 1

    Notes
    Changed
    • 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 DELETE custom 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 filter argument
    • 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.
    Fixed
    • Aligned cds.Request instantiation with other protocols for more consistent usage in custom handlers
  13. v0.4.1

    Fixes 1

    Notes
    Fixed
    • cds-plugin.js was missing in files property of package.json
  14. v0.4.0

    Features 3, Changed 2, Fixes 1

    Notes
    Added
    • Supporting new cds-plugin technique for zero configuration
    • Support for filtering by null values
    • 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
            }
          }
        }
      }
    Changed
    • Improved handling of null and undefined values in query arguments
    • Empty filter lists resolve to false and empty filter objects resolve to true
    Fixed
    • Handling of GraphQL queries that are sent via GET requests using the query URL parameter if GraphiQL is enabled
  15. v0.3.1

    Fixes 1

    Notes
    Fixed
    • Add app folder to files property of package.json to be included for publishing to npm
  16. v0.3.0

    Changed 4

    Notes
    Changed
    • Replaced deprecated GraphQL HTTP server express-graphql with graphql-http
    • Serve GraphiQL 2 via included HTML instead of relying on the server framework (express-graphql included GraphiQL 1)
    • Bump graphql version to 16
    • Execute query resolvers in parallel and mutation resolvers serially
  17. v0.2.0

    Changed 2, Fixes 2

    Notes
    Changed
    • Register aliasFieldResolver during schema generation instead of passing it to the GraphQL server
    • The filters contains, startswith, and endswith now generate CQN function calls instead of generating like expressions directly
    Fixed
    • Schema generation crash that occurred if an entity property is named localized
    • The field totalCount could not be queried on its own
  18. v0.1.0

    Features 5, Changed 2

    Notes
    Added
    • To-many relationships are now represented by an additional nesting level which contains the fields totalCount and nodes. totalCount is similar to OData $count. nodes contains the fields belonging to the entity. This is similar to the GraphQL cursor connection specification, but without an additional second edges nesting 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 texts fields of entities in schema generation
    • Improve check to skip field localized during schema generation
    Changed
    • The GraphQL protocol adapter now uses a new middlewares mechanism instead of cds.plugins which requires @sap/cds version 6.3 to run. Enable the cds.requires.middlewares flag and register the GraphQL protocol adapter in cds.env.protocols to get started.
    • Replaced debug level query and mutation logging with improved info level request logging
185downloads per week, npm
Weekly downloads for @cap-js/graphql26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 185.27 Apr – 3 May: 6084 May – 10 May: 99111 May – 17 May: 1,38818 May – 24 May: 96425 May – 31 May: 5861 Jun – 7 Jun: 6188 Jun – 14 Jun: 68715 Jun – 21 Jun: 60822 Jun – 28 Jun: 71329 Jun – 5 Jul: 6766 Jul – 12 Jul: 75913 Jul – 19 Jul: 1,10520 Jul – 26 Jul: 87927 Jul – 2 Aug: 8233 Aug – 9 Aug: 74510 Aug – 16 Aug: 61417 Aug – 23 Aug: 69724 Aug – 30 Aug: 77931 Aug – 6 Sept: 6937 Sept – 13 Sept: 57214 Sept – 20 Sept: 71521 Sept – 27 Sept: 78728 Sept – 4 Oct: 1,0555 Oct – 11 Oct: 77012 Oct – 18 Oct: 1,72619 Oct – 25 Oct: 185

Details

Sources5
npm registrydiscovered herechecked
The discovery passdiscovered herechecked
npm registry, @cap-js/graphqlversion, releases, installschecked
github.com/git+https://github.com/cap-js/graphql.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
declared for>=9
latestv0.14.0
first release
releases and cadence19, ~67d median
discovered vianpm registry, The discovery pass
first seen in the atlas
ecosystem and domaincap, protocols-and-apis
Flavors1
Node.js
“A GraphQL protocol adapter for [SAP Cloud Application Programming Model](https://cap.cloud.sap) Node.js.” — cap-js/graphql — READMEchecked
Contributors22
History in the atlas2
  1. A protocol adapter that generates a GraphQL schema from the model and serves it, so the same services answer GraphQL without a second definition of them.
  2. First seen.
For your agent
Ref
artifact:cap-js-graphql
JSON
/artifacts/cap-js-graphql.json
MCP
Connecting an agent