Skip to content

[BUG] openapi compilation defaults to rest on url creation, while cap defaults to odata-v4 when starting the service #174

Description

@cronossclk

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The CAP OpenAPI generator generates an OpenAPI document with OData V4 metadata but uses the /rest protocol path in the server URL, even when the service runs through the default OData V4 endpoint.

Reproduction

Example service:

@path: 'catalog'
service CatalogService {
    entity Books {
        key ID : Integer;
        title   : String;
    }
}

Run:
cds compile srv --service CatalogService --to openapi

Yields:

{
  "x-odata-version": "4.01",
  "servers": [
    {
      "url": "/rest/catalog"
    }
  ]
}

Expected Behavior

Running the command at the top should yield

{
  "servers": [
    {
      "url": "/odata/v4/catalog"
    }
  ]
}

to match the default behavior of CAP.

Steps To Reproduce

See current behavior

Environment

- **OS**: MacOS
- **Node**: 24.18.0
- **npm**: using yarn
- **@cap-js/openapi**: 1.5.0
- **cds**: 9.9.3
- **cds-dki**: 9.9.4

Repository Containing a Minimal Reproducible Example

No response

Anything else?

No response

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