SAP / cloud-sdk-js

Use the SAP Cloud SDK for JavaScript / TypeScript to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
167 stars 57 forks source link

OpenAPI generator ignores the `basePath` field #5189

Open lorenzofratus-syscons opened 1 week ago

lorenzofratus-syscons commented 1 week ago

I'm trying to generate a client for an API from SAP Business Accelerator Hub (link).

The production URL for said API is of type https://api.{regionHost}/workcenter/v2 but I want to connect using an existing BTP destination with URL https://api.{regionHost} (I plan to use multiple APIs and I don't want to manage many different destinations pointing at basically the same target).

My idea was to set the basePath to /workcenter/v2 using the options-per-service.json file since, as far as I know, is a thing for OData clients, while it is not mentioned in the documentation for OpenAPI clients.

However, this didn't produce any change in the generated clients. I even tried changing the basePath in the root of the OpenAPI specification from / to /workcenter/v2 but no difference.

I would have expected the generator to prepend the base path to the actual paths defined in the specification.

I couldn't find any way to set a custom base path without having to manually edit the generated clients. In the meantime I will use a different destination for this, but I would appreciate any suggestion on how to improve the situation.

Thanks!

tomfrenken commented 5 days ago

Hi @lorenzofratus-syscons,

as you've already pointed out, we didn't implement this feature for the OpenAPI generator yet, as there was simply no demand for it. I've created a ticket in our backlog and raised this to our PO, but I can't give you a timeline yet.