Skip to content

[BUG] Compiler generates $batch request for REST service #192

Description

@lucasvaccaro

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When a CDS service is annotated with @protocol: 'rest', the OpenAPI compiler still generates a /$batch path item in the output, but it is specific to OData.

Expected Behavior

The compiler should not generate /$batch endpoint for REST services.

Steps To Reproduce

  1. Define a REST CDS service:
@path    : '/rest/v1/myRestAPI'
@protocol: 'rest'
service MyRestAPI {
  action send();
}
  1. cds compile <file>.cds --to openapi
  2. Inspect the generated file

Environment

| Package                | Version | Location                                                   |
 | ---------------------- | ------- | ---------------------------------------------------------- |
 | @sap/cds-dk            | 9.9.1   | ./node_modules/@sap/cds-dk                                 |
 | @sap/cds               | 9.6.4   | ./node_modules/@sap/cds                                    |
 | @sap/cds-compiler      | 6.6.2   | ./node_modules/@sap/cds-compiler                           |
 | @sap/cds-fiori         | 2.1.1   | ./node_modules/@sap/cds-fiori                              |
 | @sap/cds-mtxs          | 3.9.7   | ./node_modules/@sap/cds-mtxs                               |
 | @cap-js/asyncapi       | 1.1.0   | ./node_modules/@cap-js/asyncapi                            |
 | @cap-js/cds-test       | 0.4.1   | ./node_modules/@cap-js/cds-test                            |
 | @cap-js/cds-types      | 0.15.0  | ./node_modules/@cap-js/cds-types                           |
 | @cap-js/db-service     | 2.8.1   | ./node_modules/@cap-js/db-service                          |
 | @cap-js/hana           | 2.5.1   | ./node_modules/@cap-js/hana                                |
 | @cap-js/openapi        | 1.6.0   | ./node_modules/@cap-js/openapi                             |
 | @cap-js/ord            | 1.9.3   | ./node_modules/@cap-js/ord                                 |
 | @cap-js/sqlite         | 2.1.2   | ./node_modules/@cap-js/sqlite                              |
 | @cap-js/sqlite         | 2.4.0   | ./node_modules/@sap/cds-dk/node_modules/@cap-js/sqlite     |
 | @cap-js/telemetry      | 2.0.1   | ./node_modules/@cap-js/telemetry                           |
 | @sap/eslint-plugin-cds | 2.7.0   | ./node_modules/@sap/eslint-plugin-cds                      |
 | cds.home               |         | ./node_modules/@sap/cds                                    |
 | npm root -l            |         | ./node_modules                                             |
 | npm root -g            |         | ~/.nvm/versions/node/v22.23.1/lib/node_modules             |
 | Node.js                | 22.23.1 | ~/.nvm/versions/node/v22.23.1/bin/node                     |

Repository Containing a Minimal Reproducible Example

No response

Anything else?

There is a workaround by annotating the service with @Capabilities.BatchSupported: false, so there is no urgency in this one.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions