Skip to content

[BUG] Entity_texts being exposed for localized entities #132

@HenriqueJRech

Description

@HenriqueJRech

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

For entities annotated with localized (eg. Books), its Entity_texts endpoint is being exposed in the openapi documentation, but requests for this endpoint:

http://localhost:4004/admin/Books_texts

Are rejected with the message:

{
  "error": {
    "code": "405",
    "message": "Entity \"AdminService.Books_texts\" is not explicitly exposed as part of the service"
  }
}

If you genera

{
  "openapi": "3.0.2",
  "info": {
    "title": "Service for namespace AdminService",
    "description": "This service is located at [/admin/](/admin/)",
    "version": ""
  },
  "x-sap-api-type": "ODATAV4",
  "x-odata-version": "4.01",
  "x-sap-shortText": "Service for namespace AdminService",
  "servers": [
    {
      "url": "/admin"
    }
  ],
  "tags": [
    {
      "name": "Authors"
    },
    {
      "name": "Books"
    },
    {
      "name": "Books_texts"
    },
    {
      "name": "Currencies"
    },
    {
      "name": "Currencies_texts"
    },
    {
      "name": "Genres"
    },
    {
      "name": "Genres_texts"
    }
  ],
  "paths": { ...
  },
  "components": { ...
  }
}

Expected Behavior

Do not expose the Entity_texts endpoints if not explicitly declared, for example:

service AdminService @(path:'/admin') {
  entity Authors as projection on my.Authors;
  entity Books as projection on my.Books;

  entity Books.texts as projection on my.Books.texts;

  entity Genres as projection on my.Genres;
}

Steps To Reproduce

  1. Clone the https://github.com/capire/bookshop locally
  2. Run npm i
  3. cds compile ./srv --to openapi -s all -o openapi
  4. Open the ./openapi/AdminService.openapi3.json file to see the _texts entities

Environment

- **OS**: macOS 26.2 (25C56)
- **Node**: v22.21.1
- **npm**: 11.7.0
- **@cap-js/openapi**: 
- **cds**:
| @capire/bookshop | https://github.com/<your/repo> |
|:---------------------- | ----------- |
| Node.js                | v22.21.1    |
| @sap/cds               | 7.6.3       |
| @sap/cds-compiler      | 4.6.2       |
| @sap/cds-dk            | -- missing  |
| @sap/cds-dk (global)   | 7.6.1       |
| @sap/eslint-plugin-cds | 2.6.5       |
| @sap/cds-mtxs          | 1.15.0      |
| @cap-js/cds-types      | 0.2.0       |

Repository Containing a Minimal Reproducible Example

https://github.com/capire/bookshop

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions