From 936a6ebf90009c0065c0513cb34cf72e676f43fa Mon Sep 17 00:00:00 2001 From: KavithaSiva <32287936+KavithaSiva@users.noreply.github.com> Date: Fri, 27 Dec 2024 10:52:53 +0100 Subject: [PATCH] feat: Support `basePath` in options-per-service for openapi generator - Option 2 (#5247) (#5311) --- .changeset/chilled-flowers-freeze.md | 5 + .changeset/chilled-flowers-hide.md | 7 + .github/actions/check-public-api/index.js | 3 + .../__snapshots__/api-file.spec.ts.snap | 87 +++++++++--- .../__snapshots__/operation.spec.ts.snap | 7 +- .../src/file-serializer/api-file.spec.ts | 19 ++- .../src/file-serializer/api-file.ts | 9 +- .../src/file-serializer/operation.spec.ts | 125 ++++++++++-------- .../src/file-serializer/operation.ts | 11 +- .../openapi-generator/src/generator.spec.ts | 7 +- packages/openapi-generator/src/generator.ts | 7 +- .../src/openapi-request-builder.spec.ts | 33 ++++- .../openapi/src/openapi-request-builder.ts | 28 +++- packages/util/src/remove-slashes.spec.ts | 17 +++ packages/util/src/remove-slashes.ts | 3 + test-packages/e2e-tests/openapi.js | 4 +- .../test/openapi-negative-case.spec.ts | 4 +- .../generate-openapi-services.ts | 17 ++- .../no-schema-service/default-api.d.ts | 1 + .../no-schema-service/default-api.js | 3 +- .../no-schema-service/default-api.js.map | 2 +- .../no-schema-service/default-api.ts | 4 +- .../swagger-yaml-service/default-api.d.ts | 1 + .../swagger-yaml-service/default-api.js | 5 +- .../swagger-yaml-service/default-api.js.map | 2 +- .../swagger-yaml-service/default-api.ts | 27 ++-- .../test-service/default-api.d.ts | 1 + .../test-service/default-api.js | 5 +- .../test-service/default-api.js.map | 2 +- .../test-service/default-api.ts | 16 ++- .../test-service/entity-api.d.ts | 1 + .../test-service/entity-api.js | 17 +-- .../test-service/entity-api.js.map | 2 +- .../test-service/entity-api.ts | 82 +++++++++--- .../test-service/extension-api.d.ts | 1 + .../test-service/extension-api.js | 5 +- .../test-service/extension-api.js.map | 2 +- .../test-service/extension-api.ts | 15 ++- .../test-service/tag-dot-api.d.ts | 1 + .../test-service/tag-dot-api.js | 3 +- .../test-service/tag-dot-api.js.map | 2 +- .../test-service/tag-dot-api.ts | 8 +- .../test-service/tag-space-api.d.ts | 1 + .../test-service/tag-space-api.js | 3 +- .../test-service/tag-space-api.js.map | 2 +- .../test-service/tag-space-api.ts | 8 +- .../test-service/test-case-api.d.ts | 1 + .../test-service/test-case-api.js | 31 ++--- .../test-service/test-case-api.js.map | 2 +- .../test-service/test-case-api.ts | 112 +++++++++++----- .../config/options-per-service.json | 15 +++ .../no-schema-service.yml | 0 .../swagger-yaml-service.yml | 0 .../{ => specifications}/test-service.json | 0 54 files changed, 561 insertions(+), 215 deletions(-) create mode 100644 .changeset/chilled-flowers-freeze.md create mode 100644 .changeset/chilled-flowers-hide.md create mode 100644 packages/util/src/remove-slashes.spec.ts create mode 100644 test-resources/openapi-service-specs/config/options-per-service.json rename test-resources/openapi-service-specs/{ => specifications}/no-schema-service.yml (100%) rename test-resources/openapi-service-specs/{ => specifications}/swagger-yaml-service.yml (100%) rename test-resources/openapi-service-specs/{ => specifications}/test-service.json (100%) diff --git a/.changeset/chilled-flowers-freeze.md b/.changeset/chilled-flowers-freeze.md new file mode 100644 index 0000000000..239800903d --- /dev/null +++ b/.changeset/chilled-flowers-freeze.md @@ -0,0 +1,5 @@ +--- +'@sap-cloud-sdk/openapi': minor +--- + +[New Functionality] Introduce `setBasePath()` method on the OpenAPI request builder, allowing a custom base path URL to be set for a single request. This base path is prepended to the API path parameter for that single request. diff --git a/.changeset/chilled-flowers-hide.md b/.changeset/chilled-flowers-hide.md new file mode 100644 index 0000000000..4cd7dc30a3 --- /dev/null +++ b/.changeset/chilled-flowers-hide.md @@ -0,0 +1,7 @@ +--- +'@sap-cloud-sdk/openapi-generator': minor +'@sap-cloud-sdk/openapi': minor +'@sap-cloud-sdk/util': minor +--- + +[New Functionality] Add `basePath` option in the `options-per-service.json` file in the OpenAPI generator. This option prepends the base URL path to the API path parameter for every request. diff --git a/.github/actions/check-public-api/index.js b/.github/actions/check-public-api/index.js index 17c22ce391..e9e082f692 100644 --- a/.github/actions/check-public-api/index.js +++ b/.github/actions/check-public-api/index.js @@ -74861,6 +74861,7 @@ exports.removeTrailingSlashes = removeTrailingSlashes; exports.removeLeadingSlashes = removeLeadingSlashes; /** * @internal + * Utility function to remove a single leading and trailing slash from a path. */ function removeSlashes(path) { path = removeLeadingSlashes(path); @@ -74869,12 +74870,14 @@ function removeSlashes(path) { } /** * @internal + * Utility function to remove a single trailing slash from a path. */ function removeTrailingSlashes(path) { return path.endsWith('/') ? path.slice(0, -1) : path; } /** * @internal + * Utility function to remove a single leading slash from a path. */ function removeLeadingSlashes(path) { return path.startsWith('/') ? path.slice(1) : path; diff --git a/packages/openapi-generator/src/file-serializer/__snapshots__/api-file.spec.ts.snap b/packages/openapi-generator/src/file-serializer/__snapshots__/api-file.spec.ts.snap index 57cb322d05..0dca2d65be 100644 --- a/packages/openapi-generator/src/file-serializer/__snapshots__/api-file.spec.ts.snap +++ b/packages/openapi-generator/src/file-serializer/__snapshots__/api-file.spec.ts.snap @@ -8,8 +8,9 @@ import type { QueryParameterType, RefType, ResponseType } from './schema/index.j * This API is part of the 'MyServiceName' service. */ export const TestApi = { + _defaultBasePath: undefined, /** - * Create a request builder for execution of get requests to the 'test/{id}' endpoint. + * Create a request builder for execution of get requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @param queryParameters - Object containing the following keys: queryParam. * @param headerParameters - Object containing the following keys: headerParam. @@ -17,24 +18,26 @@ export const TestApi = { */ getFn: (id: string, queryParameters: {'queryParam': QueryParameterType}, headerParameters?: {'headerParam'?: string}) => new OpenApiRequestBuilder( 'get', - "test/{id}", + "/test/{id}", { pathParameters: { id }, queryParameters, headerParameters - } + }, + TestApi._defaultBasePath ), /** - * Create a request builder for execution of post requests to the 'test' endpoint. + * Create a request builder for execution of post requests to the '/test' endpoint. * @param body - Request body. * @returns The request builder, use the \`execute()\` method to trigger the request. */ createFn: (body: RefType) => new OpenApiRequestBuilder( 'post', - "test", + "/test", { body - } + }, + TestApi._defaultBasePath ) };" `; @@ -46,13 +49,16 @@ exports[`api-file creates an api file with documentation 1`] = ` * This API is part of the 'TestService' service. */ export const TestApi = { + _defaultBasePath: undefined, /** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: () => new OpenApiRequestBuilder( 'get', - "test" + "/test", + {}, + TestApi._defaultBasePath ) };" `; @@ -72,8 +78,9 @@ import type { QueryParameterType, RefType, ResponseType } from './schema'; * This API is part of the 'MyServiceName' service. */ export const TestApi = { + _defaultBasePath: undefined, /** - * Create a request builder for execution of get requests to the 'test/{id}' endpoint. + * Create a request builder for execution of get requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @param queryParameters - Object containing the following keys: queryParam. * @param headerParameters - Object containing the following keys: headerParam. @@ -81,24 +88,68 @@ export const TestApi = { */ getFn: (id: string, queryParameters: {'queryParam': QueryParameterType}, headerParameters?: {'headerParam'?: string}) => new OpenApiRequestBuilder( 'get', - "test/{id}", + "/test/{id}", { pathParameters: { id }, queryParameters, headerParameters - } + }, + TestApi._defaultBasePath ), /** - * Create a request builder for execution of post requests to the 'test' endpoint. + * Create a request builder for execution of post requests to the '/test' endpoint. * @param body - Request body. * @returns The request builder, use the \`execute()\` method to trigger the request. */ createFn: (body: RefType) => new OpenApiRequestBuilder( 'post', - "test", + "/test", { body - } + }, + TestApi._defaultBasePath + ) +};" +`; + +exports[`api-file serializes api file with multiple operations and references and base path 1`] = ` +"import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; +import type { QueryParameterType, RefType, ResponseType } from './schema'; +/** + * Representation of the 'TestApi'. + * This API is part of the 'MyServiceName' service. + */ +export const TestApi = { + _defaultBasePath: '/base/path/to/service', + /** + * Create a request builder for execution of get requests to the '/test/{id}' endpoint. + * @param id - Path parameter. + * @param queryParameters - Object containing the following keys: queryParam. + * @param headerParameters - Object containing the following keys: headerParam. + * @returns The request builder, use the \`execute()\` method to trigger the request. + */ + getFn: (id: string, queryParameters: {'queryParam': QueryParameterType}, headerParameters?: {'headerParam'?: string}) => new OpenApiRequestBuilder( + 'get', + "/test/{id}", + { + pathParameters: { id }, + queryParameters, + headerParameters + }, + TestApi._defaultBasePath + ), + /** + * Create a request builder for execution of post requests to the '/test' endpoint. + * @param body - Request body. + * @returns The request builder, use the \`execute()\` method to trigger the request. + */ + createFn: (body: RefType) => new OpenApiRequestBuilder( + 'post', + "/test", + { + body + }, + TestApi._defaultBasePath ) };" `; @@ -110,17 +161,19 @@ exports[`api-file serializes api file with one operation and no references 1`] = * This API is part of the 'MyServiceName' service. */ export const TestApi = { + _defaultBasePath: undefined, /** - * Create a request builder for execution of get requests to the 'test/{id}' endpoint. + * Create a request builder for execution of get requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (id: string) => new OpenApiRequestBuilder( 'get', - "test/{id}", + "/test/{id}", { pathParameters: { id } - } + }, + TestApi._defaultBasePath ) };" `; diff --git a/packages/openapi-generator/src/file-serializer/__snapshots__/operation.spec.ts.snap b/packages/openapi-generator/src/file-serializer/__snapshots__/operation.spec.ts.snap index 994c848701..834a6c973a 100644 --- a/packages/openapi-generator/src/file-serializer/__snapshots__/operation.spec.ts.snap +++ b/packages/openapi-generator/src/file-serializer/__snapshots__/operation.spec.ts.snap @@ -2,15 +2,16 @@ exports[`serializeOperation serializes operation with path parameters inside () 1`] = ` "/** - * Create a request builder for execution of get requests to the 'test('{id}')' endpoint. + * Create a request builder for execution of get requests to the '/test('{id}')' endpoint. * @param id - Path parameter. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (id: string) => new OpenApiRequestBuilder>( 'get', - "test('{id}')", + "/test('{id}')", { pathParameters: { id } - } + }, + TestApi._defaultBasePath )" `; diff --git a/packages/openapi-generator/src/file-serializer/api-file.spec.ts b/packages/openapi-generator/src/file-serializer/api-file.spec.ts index 91a925f79c..5676442524 100644 --- a/packages/openapi-generator/src/file-serializer/api-file.spec.ts +++ b/packages/openapi-generator/src/file-serializer/api-file.spec.ts @@ -23,7 +23,7 @@ const singleOperationApi: OpenApiApi = { headerParameters: [], response: { type: 'any' }, responses: { 200: { description: 'some response description' } }, - pathPattern: 'test/{id}' + pathPattern: '/test/{id}' } ] }; @@ -71,7 +71,7 @@ const multipleOperationApi: OpenApiApi = { schemaProperties: {} } ], - pathPattern: 'test/{id}', + pathPattern: '/test/{id}', response: { type: 'string' } }, { @@ -89,7 +89,7 @@ const multipleOperationApi: OpenApiApi = { schemaName: 'RefType' } as OpenApiReferenceSchema }, - pathPattern: 'test', + pathPattern: '/test', response: { $ref: '#/components/schemas/ResponseType', schemaName: 'ResponseType' @@ -110,7 +110,7 @@ const docsApi: OpenApiApi = { queryParameters: [], headerParameters: [], response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' } ] }; @@ -124,6 +124,17 @@ describe('api-file', () => { expect(apiFile(multipleOperationApi, 'MyServiceName')).toMatchSnapshot(); }); + it('serializes api file with multiple operations and references and base path', () => { + expect( + apiFile( + multipleOperationApi, + 'MyServiceName', + undefined, + '/base/path/to/service' + ) + ).toMatchSnapshot(); + }); + it('creates an api file with documentation', () => { expect(apiFile(docsApi, 'TestService')).toMatchSnapshot(); }); diff --git a/packages/openapi-generator/src/file-serializer/api-file.ts b/packages/openapi-generator/src/file-serializer/api-file.ts index baf8062340..749143b58d 100644 --- a/packages/openapi-generator/src/file-serializer/api-file.ts +++ b/packages/openapi-generator/src/file-serializer/api-file.ts @@ -16,25 +16,28 @@ import type { * Serialize an API representation to a string representing the resulting API file. * @param api - Representation of an API. * @param serviceName - Service name for which the API is created. + * @param options - Options to configure the file creation. + * @param basePath - Custom base path for the API. * @returns The serialized API file contents. * @internal */ export function apiFile( api: OpenApiApi, serviceName: string, - options?: CreateFileOptions + options?: CreateFileOptions, + basePath?: string ): string { const imports = serializeImports(getImports(api, options)); const apiDoc = apiDocumentation(api, serviceName); const apiContent = codeBlock` export const ${api.name} = { - ${api.operations.map(operation => serializeOperation(operation)).join(',\n')} + _defaultBasePath: ${basePath ? `'${basePath}'` : undefined}, + ${api.operations.map(operation => serializeOperation(operation, api.name)).join(',\n')} }; `; return [imports, apiDoc, apiContent].join(unixEOL); } - /** * Get the unique reference schemas for all request body types in the given operation list. * @param operations - The given operation list. diff --git a/packages/openapi-generator/src/file-serializer/operation.spec.ts b/packages/openapi-generator/src/file-serializer/operation.spec.ts index e2500747d7..386371bc4e 100644 --- a/packages/openapi-generator/src/file-serializer/operation.spec.ts +++ b/packages/openapi-generator/src/file-serializer/operation.spec.ts @@ -6,6 +6,7 @@ import type { } from '../openapi-types'; describe('serializeOperation', () => { + const apiName = 'TestApi'; it('serializes operation with path, query and header parameters', () => { const operation: OpenApiOperation = { operationId: 'getFn', @@ -49,11 +50,11 @@ describe('serializeOperation', () => { ], responses: { 200: { description: 'some response description' } }, response: { type: 'string' }, - pathPattern: 'test/{id}/{subId}' + pathPattern: '/test/{id}/{subId}' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test/{id}/{subId}' endpoint. + * Create a request builder for execution of get requests to the '/test/{id}/{subId}' endpoint. * @param id - Path parameter. * @param subId - Path parameter. * @param queryParameters - Object containing the following keys: limit. @@ -62,12 +63,13 @@ describe('serializeOperation', () => { */ getFn: (id: string, subId: string, queryParameters?: {'limit'?: number}, headerParameters?: {'resource-group'?: string}) => new OpenApiRequestBuilder( 'get', - "test/{id}/{subId}", + "/test/{id}/{subId}", { pathParameters: { id, subId }, queryParameters, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -102,23 +104,24 @@ describe('serializeOperation', () => { additionalProperties: { type: 'any' }, properties: [] }, - pathPattern: 'test/{id}' + pathPattern: '/test/{id}' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of delete requests to the 'test/{id}' endpoint. + * Create a request builder for execution of delete requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @param headerParameters - Object containing the following keys: resource-group. * @returns The request builder, use the \`execute()\` method to trigger the request. */ deleteFn: (id: string, headerParameters?: {'resource-group'?: string}) => new OpenApiRequestBuilder>( 'delete', - "test/{id}", + "/test/{id}", { pathParameters: { id }, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -145,21 +148,22 @@ describe('serializeOperation', () => { additionalProperties: { type: 'any' }, properties: [] }, - pathPattern: 'test/{id}' + pathPattern: '/test/{id}' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of delete requests to the 'test/{id}' endpoint. + * Create a request builder for execution of delete requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @returns The request builder, use the \`execute()\` method to trigger the request. */ deleteFn: (id: string) => new OpenApiRequestBuilder>( 'delete', - "test/{id}", + "/test/{id}", { pathParameters: { id } - } + }, + TestApi._defaultBasePath )" `); }); @@ -186,10 +190,10 @@ describe('serializeOperation', () => { additionalProperties: { type: 'any' }, properties: [] }, - pathPattern: "test('{id}')" + pathPattern: "/test('{id}')" }; - expect(serializeOperation(operation)).toMatchSnapshot(); + expect(serializeOperation(operation, apiName)).toMatchSnapshot(); }); it('serializes operation with optional query and required header parameters', () => { @@ -228,23 +232,24 @@ describe('serializeOperation', () => { ], responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @param queryParameters - Object containing the following keys: limit, page. * @param headerParameters - Object containing the following keys: resource-group. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (queryParameters: {'limit'?: number, 'page'?: number}, headerParameters: {'resource-group': string}) => new OpenApiRequestBuilder( 'get', - "test", + "/test", { queryParameters, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -293,23 +298,24 @@ describe('serializeOperation', () => { ], responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @param queryParameters - Object containing the following keys: limit, page. * @param headerParameters - Object containing the following keys: authentication, resource-group. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (queryParameters: {'limit'?: number, 'page'?: number}, headerParameters: {'authentication': string, 'resource-group'?: string}) => new OpenApiRequestBuilder( 'get', - "test", + "/test", { queryParameters, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -342,23 +348,24 @@ describe('serializeOperation', () => { ], responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @param queryParameters - Object containing the following keys: limit. * @param headerParameters - Object containing the following keys: resource-group. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (queryParameters: {'limit': number}, headerParameters?: {'resource-group'?: string}) => new OpenApiRequestBuilder( 'get', - "test", + "/test", { queryParameters, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -399,23 +406,24 @@ describe('serializeOperation', () => { ], responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @param queryParameters - Object containing the following keys: limit, page. * @param headerParameters - Object containing the following keys: resource-group. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (queryParameters: {'limit': number, 'page'?: number}, headerParameters: {'resource-group': string}) => new OpenApiRequestBuilder( 'get', - "test", + "/test", { queryParameters, headerParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -438,21 +446,22 @@ describe('serializeOperation', () => { headerParameters: [], responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of get requests to the 'test' endpoint. + * Create a request builder for execution of get requests to the '/test' endpoint. * @param queryParameters - Object containing the following keys: limit. * @returns The request builder, use the \`execute()\` method to trigger the request. */ getFn: (queryParameters?: {'limit'?: number}) => new OpenApiRequestBuilder( 'get', - "test", + "/test", { queryParameters - } + }, + TestApi._defaultBasePath )" `); }); @@ -483,22 +492,23 @@ describe('serializeOperation', () => { }, responses: { 200: { description: 'some response description' } }, response: { type: 'any' }, - pathPattern: 'test/{id}' + pathPattern: '/test/{id}' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of post requests to the 'test/{id}' endpoint. + * Create a request builder for execution of post requests to the '/test/{id}' endpoint. * @param id - Path parameter. * @param body - Request body. * @returns The request builder, use the \`execute()\` method to trigger the request. */ createFn: (id: string, body: Record) => new OpenApiRequestBuilder( 'post', - "test/{id}", + "/test/{id}", { pathParameters: { id }, body - } + }, + TestApi._defaultBasePath )" `); }); @@ -520,21 +530,22 @@ describe('serializeOperation', () => { } as OpenApiReferenceSchema }, response: { type: 'string' }, - pathPattern: 'test' + pathPattern: '/test' }; - expect(serializeOperation(operation)).toMatchInlineSnapshot(` + expect(serializeOperation(operation, apiName)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of post requests to the 'test' endpoint. + * Create a request builder for execution of post requests to the '/test' endpoint. * @param body - Request body. * @returns The request builder, use the \`execute()\` method to trigger the request. */ fnWithRefBody: (body: RefType | undefined) => new OpenApiRequestBuilder( 'post', - "test", + "/test", { body - } + }, + TestApi._defaultBasePath )" `); }); @@ -543,7 +554,7 @@ describe('serializeOperation', () => { return { response: { type: 'string' }, method: 'GET', - pathPattern: 'my/Api', + pathPattern: '/my/Api', pathParameters: [] as OpenApiParameter[], queryParameters: [] as OpenApiParameter[] } as OpenApiOperation; @@ -553,7 +564,7 @@ describe('serializeOperation', () => { const operation = getOperation(); expect(operationDocumentation(operation)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of GET requests to the 'my/Api' endpoint. + * Create a request builder for execution of GET requests to the '/my/Api' endpoint. * @returns The request builder, use the \`execute()\` method to trigger the request. */" `); @@ -575,7 +586,7 @@ describe('serializeOperation', () => { ] as OpenApiParameter[]; expect(operationDocumentation(operation)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of GET requests to the 'my/Api' endpoint. + * Create a request builder for execution of GET requests to the '/my/Api' endpoint. * @param pathParameter1 - Path parameter. * @param path-parameter-2 - Path parameter. * @returns The request builder, use the \`execute()\` method to trigger the request. @@ -607,7 +618,7 @@ describe('serializeOperation', () => { ] as OpenApiParameter[]; expect(operationDocumentation(operation)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of GET requests to the 'my/Api' endpoint. + * Create a request builder for execution of GET requests to the '/my/Api' endpoint. * @param queryParameters - Object containing the following keys: queryParameter1, queryParameter2. * @param headerParameters - Object containing the following keys: headerParameter1. * @returns The request builder, use the \`execute()\` method to trigger the request. @@ -620,7 +631,7 @@ describe('serializeOperation', () => { operation.requestBody = { schema: { type: 'string' }, required: true }; expect(operationDocumentation(operation)).toMatchInlineSnapshot(` "/** - * Create a request builder for execution of GET requests to the 'my/Api' endpoint. + * Create a request builder for execution of GET requests to the '/my/Api' endpoint. * @param body - Request body. * @returns The request builder, use the \`execute()\` method to trigger the request. */" diff --git a/packages/openapi-generator/src/file-serializer/operation.ts b/packages/openapi-generator/src/file-serializer/operation.ts index dfa41663d2..593e650afd 100644 --- a/packages/openapi-generator/src/file-serializer/operation.ts +++ b/packages/openapi-generator/src/file-serializer/operation.ts @@ -9,10 +9,14 @@ import type { /** * Serialize an operation to a string. * @param operation - Operation to serialize. + * @param apiName - Name of the API the operation is part of. * @returns The operation as a string. * @internal */ -export function serializeOperation(operation: OpenApiOperation): string { +export function serializeOperation( + operation: OpenApiOperation, + apiName: string +): string { const requestBuilderParams = [ `'${operation.method}'`, `"${operation.pathPattern}"` @@ -21,6 +25,8 @@ export function serializeOperation(operation: OpenApiOperation): string { const bodyAndQueryParams = serializeParamsForRequestBuilder(operation); if (bodyAndQueryParams) { requestBuilderParams.push(bodyAndQueryParams); + } else { + requestBuilderParams.push('{}'); } const responseType = serializeSchema(operation.response); @@ -29,7 +35,8 @@ ${operationDocumentation(operation)} ${operation.operationId}: (${serializeOperationSignature( operation )}) => new OpenApiRequestBuilder<${responseType}>( - ${requestBuilderParams.join(',\n')} + ${requestBuilderParams.join(',\n')}, + ${apiName}._defaultBasePath )`; } diff --git a/packages/openapi-generator/src/generator.spec.ts b/packages/openapi-generator/src/generator.spec.ts index 3513e1cef3..7ba1600f10 100644 --- a/packages/openapi-generator/src/generator.spec.ts +++ b/packages/openapi-generator/src/generator.spec.ts @@ -98,7 +98,7 @@ describe('generator', () => { mock.restore(); const inputFile = resolve( __dirname, - '../../../test-resources/openapi-service-specs/test-service.json' + '../../../test-resources/openapi-service-specs/specifications/test-service.json' ); const serviceSpec = await promises.readFile(inputFile, { encoding: 'utf8' @@ -212,7 +212,7 @@ describe('generator', () => { }) }, existingConfig: - '{ "inputDir/spec.json": {"directoryName": "customName" } }', + '{ "inputDir/spec.json": {"directoryName": "customName" , "basePath": "/base/path/for/service" } }', anotherConfig: '{ "inputDir/spec2.json": {"directoryName": "customName" } }' }); @@ -251,7 +251,8 @@ describe('generator', () => { await expect(JSON.parse(actual)).toEqual({ 'inputDir/spec.json': { packageName: 'customname', - directoryName: 'customName' + directoryName: 'customName', + basePath: '/base/path/for/service' } }); }); diff --git a/packages/openapi-generator/src/generator.ts b/packages/openapi-generator/src/generator.ts index 73ce07f6d9..0d810696f1 100644 --- a/packages/openapi-generator/src/generator.ts +++ b/packages/openapi-generator/src/generator.ts @@ -223,7 +223,12 @@ async function createApis( createFile( serviceDir, `${kebabCase(api.name)}.ts`, - apiFile(api, openApiDocument.serviceName, options), + apiFile( + api, + openApiDocument.serviceName, + options, + openApiDocument.serviceOptions.basePath + ), options ) ) diff --git a/packages/openapi/src/openapi-request-builder.spec.ts b/packages/openapi/src/openapi-request-builder.spec.ts index 3c56841f4c..1a7d859a71 100644 --- a/packages/openapi/src/openapi-request-builder.spec.ts +++ b/packages/openapi/src/openapi-request-builder.spec.ts @@ -36,7 +36,7 @@ describe('openapi-request-builder', () => { httpSpy.mockClear(); }); - it('executeRaw executes a request without parameters', async () => { + it('executes a request without parameters using executeRaw', async () => { const requestBuilder = new OpenApiRequestBuilder('get', '/test'); const response = await requestBuilder.executeRaw(destination); expect(httpSpy).toHaveBeenCalledWith( @@ -54,7 +54,7 @@ describe('openapi-request-builder', () => { expect(response.data).toBe(dummyResponse); }); - it('executeRaw executes a request with query parameters', async () => { + it('executes a request with query parameters using executeRaw', async () => { const requestBuilder = new OpenApiRequestBuilder('get', '/test', { queryParameters: { limit: 100 @@ -76,7 +76,28 @@ describe('openapi-request-builder', () => { expect(response.data).toBe(dummyResponse); }); - it('executeRaw executes a request with header parameters', async () => { + it('executes a request without parameters and basePath explicitly set using executeRaw', async () => { + const requestBuilder = new OpenApiRequestBuilder( + 'get', + '/test' + ).setBasePath('/base/path/to/service'); + const response = await requestBuilder.executeRaw(destination); + expect(httpClient.executeHttpRequest).toHaveBeenCalledWith( + sanitizeDestination(destination), + { + method: 'get', + middleware: [], + url: 'base/path/to/service/test', + headers: { requestConfig: {} }, + params: { requestConfig: {} }, + data: undefined + }, + { fetchCsrfToken: false } + ); + expect(response.data).toBe(dummyResponse); + }); + + it('executes a request with header parameters using executeRaw', async () => { const destinationWithAuth = { ...destination, headers: { authorization: 'destAuth' } @@ -104,7 +125,7 @@ describe('openapi-request-builder', () => { expect(response.data).toBe(dummyResponse); }); - it('executeRaw executes a request with body', async () => { + it('executes a request with body using executeRaw', async () => { const requestBuilder = new OpenApiRequestBuilder('post', '/test', { body: { limit: 100 @@ -230,7 +251,7 @@ describe('openapi-request-builder', () => { expect(response.data).toBe('iss token used on the way'); }); - it('addCustomHeaders', async () => { + it('should add custom headers', async () => { const requestBuilder = new OpenApiRequestBuilder('get', '/test'); const destinationWithAuth = { ...destination, @@ -297,7 +318,7 @@ describe('openapi-request-builder', () => { ); }); - it('addCustomRequestConfig', async () => { + it('should add custom request config', async () => { const requestBuilder = new OpenApiRequestBuilder('get', '/test'); const response = await requestBuilder .addCustomRequestConfiguration({ diff --git a/packages/openapi/src/openapi-request-builder.ts b/packages/openapi/src/openapi-request-builder.ts index 7d16063b43..113b75ce7d 100644 --- a/packages/openapi/src/openapi-request-builder.ts +++ b/packages/openapi/src/openapi-request-builder.ts @@ -2,6 +2,7 @@ // eslint-disable-next-line import/named import { isNullish, + removeSlashes, transformVariadicArgumentToArray } from '@sap-cloud-sdk/util'; import { useOrFetchDestination } from '@sap-cloud-sdk/connectivity'; @@ -39,11 +40,13 @@ export class OpenApiRequestBuilder { * @param method - HTTP method of the request to be built. * @param pathPattern - Path for the request containing path parameter references as in the OpenAPI specification. * @param parameters - Query parameters and or body to pass to the request. + * @param basePath - The custom path to be prefixed to the API path pattern. */ constructor( public method: Method, private pathPattern: string, - private parameters?: OpenApiRequestParameters + private parameters?: OpenApiRequestParameters, + private basePath?: string ) {} /** @@ -138,6 +141,16 @@ export class OpenApiRequestBuilder { ); } + /** + * Set the custom base path that gets prefixed to the API path parameter before a request. + * @param basePath - Base path to be set. + * @returns The request builder itself, to facilitate method chaining. + */ + setBasePath(basePath: string): this { + this.basePath = basePath; + return this; + } + /** * Get http request config. * @returns Promise of http request config with origin. @@ -175,11 +188,14 @@ export class OpenApiRequestBuilder { // Get the innermost curly bracket pairs with non-empty and legal content as placeholders. const placeholders: string[] = this.pathPattern.match(/{[^/?#{}]+}/g) || []; - return placeholders.reduce((path: string, placeholder: string) => { - const strippedPlaceholder = placeholder.slice(1, -1); - const parameterValue = pathParameters[strippedPlaceholder]; - return path.replace(placeholder, encodeURIComponent(parameterValue)); - }, this.pathPattern); + return ( + (this.basePath ? removeSlashes(this.basePath) : '') + + placeholders.reduce((path: string, placeholder: string) => { + const strippedPlaceholder = placeholder.slice(1, -1); + const parameterValue = pathParameters[strippedPlaceholder]; + return path.replace(placeholder, encodeURIComponent(parameterValue)); + }, this.pathPattern) + ); } } diff --git a/packages/util/src/remove-slashes.spec.ts b/packages/util/src/remove-slashes.spec.ts new file mode 100644 index 0000000000..5f2bc6acaa --- /dev/null +++ b/packages/util/src/remove-slashes.spec.ts @@ -0,0 +1,17 @@ +import { + removeSlashes, + removeLeadingSlashes, + removeTrailingSlashes +} from './remove-slashes'; + +describe('removeSlashes', () => { + it('removes a single leading and trailing slash', () => { + expect(removeSlashes('/test/')).toBe('test'); + }); + it('removes leading slash', () => { + expect(removeLeadingSlashes('/test')).toBe('test'); + }); + it('removes trailing slash', () => { + expect(removeTrailingSlashes('/test/')).toBe('/test'); + }); +}); diff --git a/packages/util/src/remove-slashes.ts b/packages/util/src/remove-slashes.ts index 953ad20433..972f0e4ab3 100644 --- a/packages/util/src/remove-slashes.ts +++ b/packages/util/src/remove-slashes.ts @@ -1,5 +1,6 @@ /** * @internal + * Utility function to remove a single leading and trailing slash from a path. */ export function removeSlashes(path: string): string { path = removeLeadingSlashes(path); @@ -9,6 +10,7 @@ export function removeSlashes(path: string): string { /** * @internal + * Utility function to remove a single trailing slash from a path. */ export function removeTrailingSlashes(path: string): string { return path.endsWith('/') ? path.slice(0, -1) : path; @@ -16,6 +18,7 @@ export function removeTrailingSlashes(path: string): string { /** * @internal + * Utility function to remove a single leading slash from a path. */ export function removeLeadingSlashes(path: string): string { return path.startsWith('/') ? path.slice(1) : path; diff --git a/test-packages/e2e-tests/openapi.js b/test-packages/e2e-tests/openapi.js index 198a385ee8..8cedff1181 100644 --- a/test-packages/e2e-tests/openapi.js +++ b/test-packages/e2e-tests/openapi.js @@ -8,7 +8,7 @@ const jsf = require('json-schema-faker'); async function getSchemas() { // SchemaObject const document = await SwaggerParser.dereference( - '../../test-resources/openapi-service-specs/test-service.json' + '../../test-resources/openapi-service-specs/specifications/test-service.json' ); return document.components.schemas; @@ -24,7 +24,7 @@ function mockTestEntity(schema) { async function createApi() { const api = new OpenAPIBackend({ - definition: '../../test-resources/openapi-service-specs/test-service.json' + definition: '../../test-resources/openapi-service-specs/specifications/test-service.json' }); const schema = await getSchemas(); diff --git a/test-packages/integration-tests/test/openapi-negative-case.spec.ts b/test-packages/integration-tests/test/openapi-negative-case.spec.ts index 17c2867a49..518d6c2153 100644 --- a/test-packages/integration-tests/test/openapi-negative-case.spec.ts +++ b/test-packages/integration-tests/test/openapi-negative-case.spec.ts @@ -61,7 +61,7 @@ describe('openapi negative tests', () => { '--input', resolve( testOutputRootDir, - '../../openapi-service-specs/test-service.json' + '../../openapi-service-specs/specifications/test-service.json' ), '-o', output, @@ -89,7 +89,7 @@ describe('openapi negative tests', () => { '-i', resolve( testResourcesDir, - '../../openapi-service-specs/test-service.json' + '../../openapi-service-specs/specifications/test-service.json' ), '-o', output, diff --git a/test-packages/test-services-openapi/generate-openapi-services.ts b/test-packages/test-services-openapi/generate-openapi-services.ts index 011beedbfc..24049fdfc7 100644 --- a/test-packages/test-services-openapi/generate-openapi-services.ts +++ b/test-packages/test-services-openapi/generate-openapi-services.ts @@ -16,9 +16,22 @@ const generatorConfigOpenApi: Partial = { async function generateOpenApi() { await generate({ ...generatorConfigOpenApi, - input: resolve('..', '..', 'test-resources', 'openapi-service-specs'), + input: resolve( + '..', + '..', + 'test-resources', + 'openapi-service-specs', + 'specifications' + ), outputDir: resolve('.'), - transpile: true + transpile: true, + optionsPerService: resolve( + '..', + '..', + 'test-resources', + 'openapi-service-specs', + 'config' + ) }).catch(reason => { logger.error(`Unhandled rejection at: ${reason}`); process.exit(1); diff --git a/test-packages/test-services-openapi/no-schema-service/default-api.d.ts b/test-packages/test-services-openapi/no-schema-service/default-api.d.ts index ec3694d581..015cf44e51 100644 --- a/test-packages/test-services-openapi/no-schema-service/default-api.d.ts +++ b/test-packages/test-services-openapi/no-schema-service/default-api.d.ts @@ -9,6 +9,7 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'no-schema-service' service. */ export declare const DefaultApi: { + _defaultBasePath: string; /** * Create a request builder for execution of get requests to the '/' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. diff --git a/test-packages/test-services-openapi/no-schema-service/default-api.js b/test-packages/test-services-openapi/no-schema-service/default-api.js index f53587e333..b576ab1813 100644 --- a/test-packages/test-services-openapi/no-schema-service/default-api.js +++ b/test-packages/test-services-openapi/no-schema-service/default-api.js @@ -12,10 +12,11 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'no-schema-service' service. */ exports.DefaultApi = { + _defaultBasePath: '/base/path/to/service', /** * Create a request builder for execution of get requests to the '/' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - get: () => new openapi_1.OpenApiRequestBuilder('get', '/') + get: () => new openapi_1.OpenApiRequestBuilder('get', '/', {}, exports.DefaultApi._defaultBasePath) }; //# sourceMappingURL=default-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/no-schema-service/default-api.js.map b/test-packages/test-services-openapi/no-schema-service/default-api.js.map index d28ca80124..bc2271cfd7 100644 --- a/test-packages/test-services-openapi/no-schema-service/default-api.js.map +++ b/test-packages/test-services-openapi/no-schema-service/default-api.js.map @@ -1 +1 @@ -{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB;;;OAGG;IACH,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,+BAAqB,CAAM,KAAK,EAAE,GAAG,CAAC;CACtD,CAAC"} \ No newline at end of file +{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,gBAAgB,EAAE,uBAAuB;IACzC;;;OAGG;IACH,GAAG,EAAE,GAAG,EAAE,CACR,IAAI,+BAAqB,CAAM,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,kBAAU,CAAC,gBAAgB,CAAC;CAC9E,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/no-schema-service/default-api.ts b/test-packages/test-services-openapi/no-schema-service/default-api.ts index d8a14c1bbc..c52dc2a013 100644 --- a/test-packages/test-services-openapi/no-schema-service/default-api.ts +++ b/test-packages/test-services-openapi/no-schema-service/default-api.ts @@ -9,9 +9,11 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'no-schema-service' service. */ export const DefaultApi = { + _defaultBasePath: '/base/path/to/service', /** * Create a request builder for execution of get requests to the '/' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - get: () => new OpenApiRequestBuilder('get', '/') + get: () => + new OpenApiRequestBuilder('get', '/', {}, DefaultApi._defaultBasePath) }; diff --git a/test-packages/test-services-openapi/swagger-yaml-service/default-api.d.ts b/test-packages/test-services-openapi/swagger-yaml-service/default-api.d.ts index 51ac2ffe0e..ca7f555a75 100644 --- a/test-packages/test-services-openapi/swagger-yaml-service/default-api.d.ts +++ b/test-packages/test-services-openapi/swagger-yaml-service/default-api.d.ts @@ -10,6 +10,7 @@ import type { TestEntity } from './schema'; * This API is part of the 'swagger-yaml-service' service. */ export declare const DefaultApi: { + _defaultBasePath: undefined; /** * Test POST * @param pathParam - Path parameter. diff --git a/test-packages/test-services-openapi/swagger-yaml-service/default-api.js b/test-packages/test-services-openapi/swagger-yaml-service/default-api.js index e4349fc1e4..4c01443dbf 100644 --- a/test-packages/test-services-openapi/swagger-yaml-service/default-api.js +++ b/test-packages/test-services-openapi/swagger-yaml-service/default-api.js @@ -12,6 +12,7 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'swagger-yaml-service' service. */ exports.DefaultApi = { + _defaultBasePath: undefined, /** * Test POST * @param pathParam - Path parameter. @@ -21,7 +22,7 @@ exports.DefaultApi = { postEntity: (pathParam, queryParameters) => new openapi_1.OpenApiRequestBuilder('post', '/entities/{pathParam}', { pathParameters: { pathParam }, queryParameters - }), + }, exports.DefaultApi._defaultBasePath), /** * Create a request builder for execution of patch requests to the '/entities/{pathParam}' endpoint. * @param pathParam - Path parameter. @@ -31,6 +32,6 @@ exports.DefaultApi = { patchEntity: (pathParam, body) => new openapi_1.OpenApiRequestBuilder('patch', '/entities/{pathParam}', { pathParameters: { pathParam }, body - }) + }, exports.DefaultApi._defaultBasePath) }; //# sourceMappingURL=default-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/swagger-yaml-service/default-api.js.map b/test-packages/test-services-openapi/swagger-yaml-service/default-api.js.map index 278e603868..029c4321ef 100644 --- a/test-packages/test-services-openapi/swagger-yaml-service/default-api.js.map +++ b/test-packages/test-services-openapi/swagger-yaml-service/default-api.js.map @@ -1 +1 @@ -{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAE/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB;;;;;OAKG;IACH,UAAU,EAAE,CAAC,SAAiB,EAAE,eAAyC,EAAE,EAAE,CAC3E,IAAI,+BAAqB,CAAe,MAAM,EAAE,uBAAuB,EAAE;QACvE,cAAc,EAAE,EAAE,SAAS,EAAE;QAC7B,eAAe;KAChB,CAAC;IACJ;;;;;OAKG;IACH,WAAW,EAAE,CAAC,SAAiB,EAAE,IAA4B,EAAE,EAAE,CAC/D,IAAI,+BAAqB,CAAS,OAAO,EAAE,uBAAuB,EAAE;QAClE,cAAc,EAAE,EAAE,SAAS,EAAE;QAC7B,IAAI;KACL,CAAC;CACL,CAAC"} \ No newline at end of file +{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAE/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,gBAAgB,EAAE,SAAS;IAC3B;;;;;OAKG;IACH,UAAU,EAAE,CAAC,SAAiB,EAAE,eAAyC,EAAE,EAAE,CAC3E,IAAI,+BAAqB,CACvB,MAAM,EACN,uBAAuB,EACvB;QACE,cAAc,EAAE,EAAE,SAAS,EAAE;QAC7B,eAAe;KAChB,EACD,kBAAU,CAAC,gBAAgB,CAC5B;IACH;;;;;OAKG;IACH,WAAW,EAAE,CAAC,SAAiB,EAAE,IAA4B,EAAE,EAAE,CAC/D,IAAI,+BAAqB,CACvB,OAAO,EACP,uBAAuB,EACvB;QACE,cAAc,EAAE,EAAE,SAAS,EAAE;QAC7B,IAAI;KACL,EACD,kBAAU,CAAC,gBAAgB,CAC5B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/swagger-yaml-service/default-api.ts b/test-packages/test-services-openapi/swagger-yaml-service/default-api.ts index 7f11b8cbcc..096a59b320 100644 --- a/test-packages/test-services-openapi/swagger-yaml-service/default-api.ts +++ b/test-packages/test-services-openapi/swagger-yaml-service/default-api.ts @@ -10,6 +10,7 @@ import type { TestEntity } from './schema'; * This API is part of the 'swagger-yaml-service' service. */ export const DefaultApi = { + _defaultBasePath: undefined, /** * Test POST * @param pathParam - Path parameter. @@ -17,10 +18,15 @@ export const DefaultApi = { * @returns The request builder, use the `execute()` method to trigger the request. */ postEntity: (pathParam: string, queryParameters?: { queryParam?: string }) => - new OpenApiRequestBuilder('post', '/entities/{pathParam}', { - pathParameters: { pathParam }, - queryParameters - }), + new OpenApiRequestBuilder( + 'post', + '/entities/{pathParam}', + { + pathParameters: { pathParam }, + queryParameters + }, + DefaultApi._defaultBasePath + ), /** * Create a request builder for execution of patch requests to the '/entities/{pathParam}' endpoint. * @param pathParam - Path parameter. @@ -28,8 +34,13 @@ export const DefaultApi = { * @returns The request builder, use the `execute()` method to trigger the request. */ patchEntity: (pathParam: string, body: TestEntity | undefined) => - new OpenApiRequestBuilder('patch', '/entities/{pathParam}', { - pathParameters: { pathParam }, - body - }) + new OpenApiRequestBuilder( + 'patch', + '/entities/{pathParam}', + { + pathParameters: { pathParam }, + body + }, + DefaultApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/default-api.d.ts b/test-packages/test-services-openapi/test-service/default-api.d.ts index 784e6d8cb7..88b1bf72c4 100644 --- a/test-packages/test-services-openapi/test-service/default-api.d.ts +++ b/test-packages/test-services-openapi/test-service/default-api.d.ts @@ -9,6 +9,7 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export declare const DefaultApi: { + _defaultBasePath: undefined; /** * Create a request builder for execution of get requests to the '/test-cases/default-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. diff --git a/test-packages/test-services-openapi/test-service/default-api.js b/test-packages/test-services-openapi/test-service/default-api.js index f4d7db5eb4..e43acb0ecd 100644 --- a/test-packages/test-services-openapi/test-service/default-api.js +++ b/test-packages/test-services-openapi/test-service/default-api.js @@ -12,15 +12,16 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.DefaultApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/default-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - noTag: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/default-tag'), + noTag: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/default-tag', {}, exports.DefaultApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/default-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - defaultTag: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/default-tag') + defaultTag: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/default-tag', {}, exports.DefaultApi._defaultBasePath) }; //# sourceMappingURL=default-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/default-api.js.map b/test-packages/test-services-openapi/test-service/default-api.js.map index 23e9cf5676..bbe408f866 100644 --- a/test-packages/test-services-openapi/test-service/default-api.js.map +++ b/test-packages/test-services-openapi/test-service/default-api.js.map @@ -1 +1 @@ -{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB;;;OAGG;IACH,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,+BAAqB,CAAM,KAAK,EAAE,yBAAyB,CAAC;IAC7E;;;OAGG;IACH,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,+BAAqB,CAAM,MAAM,EAAE,yBAAyB,CAAC;CACpE,CAAC"} \ No newline at end of file +{"version":3,"file":"default-api.js","sourceRoot":"","sources":["default-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,gBAAgB,EAAE,SAAS;IAC3B;;;OAGG;IACH,KAAK,EAAE,GAAG,EAAE,CACV,IAAI,+BAAqB,CACvB,KAAK,EACL,yBAAyB,EACzB,EAAE,EACF,kBAAU,CAAC,gBAAgB,CAC5B;IACH;;;OAGG;IACH,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,+BAAqB,CACvB,MAAM,EACN,yBAAyB,EACzB,EAAE,EACF,kBAAU,CAAC,gBAAgB,CAC5B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/default-api.ts b/test-packages/test-services-openapi/test-service/default-api.ts index 56b9dd460f..4e54755238 100644 --- a/test-packages/test-services-openapi/test-service/default-api.ts +++ b/test-packages/test-services-openapi/test-service/default-api.ts @@ -9,15 +9,27 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export const DefaultApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/default-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - noTag: () => new OpenApiRequestBuilder('get', '/test-cases/default-tag'), + noTag: () => + new OpenApiRequestBuilder( + 'get', + '/test-cases/default-tag', + {}, + DefaultApi._defaultBasePath + ), /** * Create a request builder for execution of post requests to the '/test-cases/default-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ defaultTag: () => - new OpenApiRequestBuilder('post', '/test-cases/default-tag') + new OpenApiRequestBuilder( + 'post', + '/test-cases/default-tag', + {}, + DefaultApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/entity-api.d.ts b/test-packages/test-services-openapi/test-service/entity-api.d.ts index ceb020a451..b79d011129 100644 --- a/test-packages/test-services-openapi/test-service/entity-api.d.ts +++ b/test-packages/test-services-openapi/test-service/entity-api.d.ts @@ -10,6 +10,7 @@ import type { TestEntity } from './schema'; * This API is part of the 'test-service' service. */ export declare const EntityApi: { + _defaultBasePath: undefined; /** * Get all entities * @param queryParameters - Object containing the following keys: stringParameter, integerParameter, $dollarParameter, dot.parameter, enumStringParameter, enumInt32Parameter, enumDoubleParameter, enumBooleanParameter. diff --git a/test-packages/test-services-openapi/test-service/entity-api.js b/test-packages/test-services-openapi/test-service/entity-api.js index a07294ad18..c7aed72a90 100644 --- a/test-packages/test-services-openapi/test-service/entity-api.js +++ b/test-packages/test-services-openapi/test-service/entity-api.js @@ -12,6 +12,7 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.EntityApi = { + _defaultBasePath: undefined, /** * Get all entities * @param queryParameters - Object containing the following keys: stringParameter, integerParameter, $dollarParameter, dot.parameter, enumStringParameter, enumInt32Parameter, enumDoubleParameter, enumBooleanParameter. @@ -19,7 +20,7 @@ exports.EntityApi = { */ getAllEntities: (queryParameters) => new openapi_1.OpenApiRequestBuilder('get', '/entities', { queryParameters - }), + }, exports.EntityApi._defaultBasePath), /** * Create a request builder for execution of put requests to the '/entities' endpoint. * @param body - Request body. @@ -27,7 +28,7 @@ exports.EntityApi = { */ updateEntityWithPut: (body) => new openapi_1.OpenApiRequestBuilder('put', '/entities', { body - }), + }, exports.EntityApi._defaultBasePath), /** * Create entity * @param body - Entity to create @@ -35,7 +36,7 @@ exports.EntityApi = { */ createEntity: (body) => new openapi_1.OpenApiRequestBuilder('post', '/entities', { body - }), + }, exports.EntityApi._defaultBasePath), /** * Create a request builder for execution of patch requests to the '/entities' endpoint. * @param body - Request body. @@ -43,7 +44,7 @@ exports.EntityApi = { */ updateEntity: (body) => new openapi_1.OpenApiRequestBuilder('patch', '/entities', { body - }), + }, exports.EntityApi._defaultBasePath), /** * Create a request builder for execution of delete requests to the '/entities' endpoint. * @param body - Request body. @@ -51,12 +52,12 @@ exports.EntityApi = { */ deleteEntity: (body) => new openapi_1.OpenApiRequestBuilder('delete', '/entities', { body - }), + }, exports.EntityApi._defaultBasePath), /** * Head request of entities * @returns The request builder, use the `execute()` method to trigger the request. */ - headEntities: () => new openapi_1.OpenApiRequestBuilder('head', '/entities'), + headEntities: () => new openapi_1.OpenApiRequestBuilder('head', '/entities', {}, exports.EntityApi._defaultBasePath), /** * Get entity by id * @param entityId - Key property of the entity @@ -64,11 +65,11 @@ exports.EntityApi = { */ getEntityByKey: (entityId) => new openapi_1.OpenApiRequestBuilder('get', '/entities/{entityId}', { pathParameters: { entityId } - }), + }, exports.EntityApi._defaultBasePath), /** * Count entities * @returns The request builder, use the `execute()` method to trigger the request. */ - countEntities: () => new openapi_1.OpenApiRequestBuilder('get', '/entities/count') + countEntities: () => new openapi_1.OpenApiRequestBuilder('get', '/entities/count', {}, exports.EntityApi._defaultBasePath) }; //# sourceMappingURL=entity-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/entity-api.js.map b/test-packages/test-services-openapi/test-service/entity-api.js.map index 57122bb502..3be29a091b 100644 --- a/test-packages/test-services-openapi/test-service/entity-api.js.map +++ b/test-packages/test-services-openapi/test-service/entity-api.js.map @@ -1 +1 @@ -{"version":3,"file":"entity-api.js","sourceRoot":"","sources":["entity-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAE/D;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB;;;;OAIG;IACH,cAAc,EAAE,CAAC,eAShB,EAAE,EAAE,CACH,IAAI,+BAAqB,CAAe,KAAK,EAAE,WAAW,EAAE;QAC1D,eAAe;KAChB,CAAC;IACJ;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,IAA8B,EAAE,EAAE,CACtD,IAAI,+BAAqB,CAAM,KAAK,EAAE,WAAW,EAAE;QACjD,IAAI;KACL,CAAC;IACJ;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAA4B,EAAE,EAAE,CAC7C,IAAI,+BAAqB,CAAM,MAAM,EAAE,WAAW,EAAE;QAClD,IAAI;KACL,CAAC;IACJ;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAqC,EAAE,EAAE,CACtD,IAAI,+BAAqB,CAAM,OAAO,EAAE,WAAW,EAAE;QACnD,IAAI;KACL,CAAC;IACJ;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAA0B,EAAE,EAAE,CAC3C,IAAI,+BAAqB,CAAM,QAAQ,EAAE,WAAW,EAAE;QACpD,IAAI;KACL,CAAC;IACJ;;;OAGG;IACH,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,+BAAqB,CAAM,MAAM,EAAE,WAAW,CAAC;IACvE;;;;OAIG;IACH,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE,CACnC,IAAI,+BAAqB,CAAM,KAAK,EAAE,sBAAsB,EAAE;QAC5D,cAAc,EAAE,EAAE,QAAQ,EAAE;KAC7B,CAAC;IACJ;;;OAGG;IACH,aAAa,EAAE,GAAG,EAAE,CAClB,IAAI,+BAAqB,CAAS,KAAK,EAAE,iBAAiB,CAAC;CAC9D,CAAC"} \ No newline at end of file +{"version":3,"file":"entity-api.js","sourceRoot":"","sources":["entity-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAE/D;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,gBAAgB,EAAE,SAAS;IAC3B;;;;OAIG;IACH,cAAc,EAAE,CAAC,eAShB,EAAE,EAAE,CACH,IAAI,+BAAqB,CACvB,KAAK,EACL,WAAW,EACX;QACE,eAAe;KAChB,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;;OAIG;IACH,mBAAmB,EAAE,CAAC,IAA8B,EAAE,EAAE,CACtD,IAAI,+BAAqB,CACvB,KAAK,EACL,WAAW,EACX;QACE,IAAI;KACL,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAA4B,EAAE,EAAE,CAC7C,IAAI,+BAAqB,CACvB,MAAM,EACN,WAAW,EACX;QACE,IAAI;KACL,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAAqC,EAAE,EAAE,CACtD,IAAI,+BAAqB,CACvB,OAAO,EACP,WAAW,EACX;QACE,IAAI;KACL,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;;OAIG;IACH,YAAY,EAAE,CAAC,IAA0B,EAAE,EAAE,CAC3C,IAAI,+BAAqB,CACvB,QAAQ,EACR,WAAW,EACX;QACE,IAAI;KACL,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;OAGG;IACH,YAAY,EAAE,GAAG,EAAE,CACjB,IAAI,+BAAqB,CACvB,MAAM,EACN,WAAW,EACX,EAAE,EACF,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;;OAIG;IACH,cAAc,EAAE,CAAC,QAAgB,EAAE,EAAE,CACnC,IAAI,+BAAqB,CACvB,KAAK,EACL,sBAAsB,EACtB;QACE,cAAc,EAAE,EAAE,QAAQ,EAAE;KAC7B,EACD,iBAAS,CAAC,gBAAgB,CAC3B;IACH;;;OAGG;IACH,aAAa,EAAE,GAAG,EAAE,CAClB,IAAI,+BAAqB,CACvB,KAAK,EACL,iBAAiB,EACjB,EAAE,EACF,iBAAS,CAAC,gBAAgB,CAC3B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/entity-api.ts b/test-packages/test-services-openapi/test-service/entity-api.ts index abdaf0a6ba..d1ea284743 100644 --- a/test-packages/test-services-openapi/test-service/entity-api.ts +++ b/test-packages/test-services-openapi/test-service/entity-api.ts @@ -10,6 +10,7 @@ import type { TestEntity } from './schema'; * This API is part of the 'test-service' service. */ export const EntityApi = { + _defaultBasePath: undefined, /** * Get all entities * @param queryParameters - Object containing the following keys: stringParameter, integerParameter, $dollarParameter, dot.parameter, enumStringParameter, enumInt32Parameter, enumDoubleParameter, enumBooleanParameter. @@ -25,63 +26,104 @@ export const EntityApi = { enumDoubleParameter?: 1 | 2; enumBooleanParameter?: true | false; }) => - new OpenApiRequestBuilder('get', '/entities', { - queryParameters - }), + new OpenApiRequestBuilder( + 'get', + '/entities', + { + queryParameters + }, + EntityApi._defaultBasePath + ), /** * Create a request builder for execution of put requests to the '/entities' endpoint. * @param body - Request body. * @returns The request builder, use the `execute()` method to trigger the request. */ updateEntityWithPut: (body: TestEntity[] | undefined) => - new OpenApiRequestBuilder('put', '/entities', { - body - }), + new OpenApiRequestBuilder( + 'put', + '/entities', + { + body + }, + EntityApi._defaultBasePath + ), /** * Create entity * @param body - Entity to create * @returns The request builder, use the `execute()` method to trigger the request. */ createEntity: (body: TestEntity | undefined) => - new OpenApiRequestBuilder('post', '/entities', { - body - }), + new OpenApiRequestBuilder( + 'post', + '/entities', + { + body + }, + EntityApi._defaultBasePath + ), /** * Create a request builder for execution of patch requests to the '/entities' endpoint. * @param body - Request body. * @returns The request builder, use the `execute()` method to trigger the request. */ updateEntity: (body: Record | undefined) => - new OpenApiRequestBuilder('patch', '/entities', { - body - }), + new OpenApiRequestBuilder( + 'patch', + '/entities', + { + body + }, + EntityApi._defaultBasePath + ), /** * Create a request builder for execution of delete requests to the '/entities' endpoint. * @param body - Request body. * @returns The request builder, use the `execute()` method to trigger the request. */ deleteEntity: (body: string[] | undefined) => - new OpenApiRequestBuilder('delete', '/entities', { - body - }), + new OpenApiRequestBuilder( + 'delete', + '/entities', + { + body + }, + EntityApi._defaultBasePath + ), /** * Head request of entities * @returns The request builder, use the `execute()` method to trigger the request. */ - headEntities: () => new OpenApiRequestBuilder('head', '/entities'), + headEntities: () => + new OpenApiRequestBuilder( + 'head', + '/entities', + {}, + EntityApi._defaultBasePath + ), /** * Get entity by id * @param entityId - Key property of the entity * @returns The request builder, use the `execute()` method to trigger the request. */ getEntityByKey: (entityId: string) => - new OpenApiRequestBuilder('get', '/entities/{entityId}', { - pathParameters: { entityId } - }), + new OpenApiRequestBuilder( + 'get', + '/entities/{entityId}', + { + pathParameters: { entityId } + }, + EntityApi._defaultBasePath + ), /** * Count entities * @returns The request builder, use the `execute()` method to trigger the request. */ countEntities: () => - new OpenApiRequestBuilder('get', '/entities/count') + new OpenApiRequestBuilder( + 'get', + '/entities/count', + {}, + EntityApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/extension-api.d.ts b/test-packages/test-services-openapi/test-service/extension-api.d.ts index 189d9fb662..043985d7a0 100644 --- a/test-packages/test-services-openapi/test-service/extension-api.d.ts +++ b/test-packages/test-services-openapi/test-service/extension-api.d.ts @@ -9,6 +9,7 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export declare const ExtensionApi: { + _defaultBasePath: undefined; /** * Create a request builder for execution of get requests to the '/test-cases/extension' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. diff --git a/test-packages/test-services-openapi/test-service/extension-api.js b/test-packages/test-services-openapi/test-service/extension-api.js index 508710af99..6bc3ef9515 100644 --- a/test-packages/test-services-openapi/test-service/extension-api.js +++ b/test-packages/test-services-openapi/test-service/extension-api.js @@ -12,15 +12,16 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.ExtensionApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/extension' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - niceGetFunction: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/extension'), + niceGetFunction: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/extension', {}, exports.ExtensionApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/extension' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - nicePostFunction: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/extension') + nicePostFunction: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/extension', {}, exports.ExtensionApi._defaultBasePath) }; //# sourceMappingURL=extension-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/extension-api.js.map b/test-packages/test-services-openapi/test-service/extension-api.js.map index 9617f956fa..a6f5901367 100644 --- a/test-packages/test-services-openapi/test-service/extension-api.js.map +++ b/test-packages/test-services-openapi/test-service/extension-api.js.map @@ -1 +1 @@ -{"version":3,"file":"extension-api.js","sourceRoot":"","sources":["extension-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,YAAY,GAAG;IAC1B;;;OAGG;IACH,eAAe,EAAE,GAAG,EAAE,CACpB,IAAI,+BAAqB,CAAM,KAAK,EAAE,uBAAuB,CAAC;IAChE;;;OAGG;IACH,gBAAgB,EAAE,GAAG,EAAE,CACrB,IAAI,+BAAqB,CAAM,MAAM,EAAE,uBAAuB,CAAC;CAClE,CAAC"} \ No newline at end of file +{"version":3,"file":"extension-api.js","sourceRoot":"","sources":["extension-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,YAAY,GAAG;IAC1B,gBAAgB,EAAE,SAAS;IAC3B;;;OAGG;IACH,eAAe,EAAE,GAAG,EAAE,CACpB,IAAI,+BAAqB,CACvB,KAAK,EACL,uBAAuB,EACvB,EAAE,EACF,oBAAY,CAAC,gBAAgB,CAC9B;IACH;;;OAGG;IACH,gBAAgB,EAAE,GAAG,EAAE,CACrB,IAAI,+BAAqB,CACvB,MAAM,EACN,uBAAuB,EACvB,EAAE,EACF,oBAAY,CAAC,gBAAgB,CAC9B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/extension-api.ts b/test-packages/test-services-openapi/test-service/extension-api.ts index 9d961f2748..ef6d99a045 100644 --- a/test-packages/test-services-openapi/test-service/extension-api.ts +++ b/test-packages/test-services-openapi/test-service/extension-api.ts @@ -9,16 +9,27 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export const ExtensionApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/extension' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ niceGetFunction: () => - new OpenApiRequestBuilder('get', '/test-cases/extension'), + new OpenApiRequestBuilder( + 'get', + '/test-cases/extension', + {}, + ExtensionApi._defaultBasePath + ), /** * Create a request builder for execution of post requests to the '/test-cases/extension' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ nicePostFunction: () => - new OpenApiRequestBuilder('post', '/test-cases/extension') + new OpenApiRequestBuilder( + 'post', + '/test-cases/extension', + {}, + ExtensionApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/tag-dot-api.d.ts b/test-packages/test-services-openapi/test-service/tag-dot-api.d.ts index e69deb0479..781df0fab4 100644 --- a/test-packages/test-services-openapi/test-service/tag-dot-api.d.ts +++ b/test-packages/test-services-openapi/test-service/tag-dot-api.d.ts @@ -9,6 +9,7 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export declare const TagDotApi: { + _defaultBasePath: undefined; /** * Create a request builder for execution of get requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. diff --git a/test-packages/test-services-openapi/test-service/tag-dot-api.js b/test-packages/test-services-openapi/test-service/tag-dot-api.js index fc10db4b37..e67fb72de2 100644 --- a/test-packages/test-services-openapi/test-service/tag-dot-api.js +++ b/test-packages/test-services-openapi/test-service/tag-dot-api.js @@ -12,10 +12,11 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.TagDotApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - tagWithDot: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/special-tag') + tagWithDot: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/special-tag', {}, exports.TagDotApi._defaultBasePath) }; //# sourceMappingURL=tag-dot-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/tag-dot-api.js.map b/test-packages/test-services-openapi/test-service/tag-dot-api.js.map index d22d161208..66e8f73cb3 100644 --- a/test-packages/test-services-openapi/test-service/tag-dot-api.js.map +++ b/test-packages/test-services-openapi/test-service/tag-dot-api.js.map @@ -1 +1 @@ -{"version":3,"file":"tag-dot-api.js","sourceRoot":"","sources":["tag-dot-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB;;;OAGG;IACH,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,+BAAqB,CAAM,KAAK,EAAE,yBAAyB,CAAC;CACnE,CAAC"} \ No newline at end of file +{"version":3,"file":"tag-dot-api.js","sourceRoot":"","sources":["tag-dot-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,gBAAgB,EAAE,SAAS;IAC3B;;;OAGG;IACH,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,+BAAqB,CACvB,KAAK,EACL,yBAAyB,EACzB,EAAE,EACF,iBAAS,CAAC,gBAAgB,CAC3B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/tag-dot-api.ts b/test-packages/test-services-openapi/test-service/tag-dot-api.ts index 727f30617c..fdfacda288 100644 --- a/test-packages/test-services-openapi/test-service/tag-dot-api.ts +++ b/test-packages/test-services-openapi/test-service/tag-dot-api.ts @@ -9,10 +9,16 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export const TagDotApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ tagWithDot: () => - new OpenApiRequestBuilder('get', '/test-cases/special-tag') + new OpenApiRequestBuilder( + 'get', + '/test-cases/special-tag', + {}, + TagDotApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/tag-space-api.d.ts b/test-packages/test-services-openapi/test-service/tag-space-api.d.ts index 463f81a71a..ba4224c07f 100644 --- a/test-packages/test-services-openapi/test-service/tag-space-api.d.ts +++ b/test-packages/test-services-openapi/test-service/tag-space-api.d.ts @@ -9,6 +9,7 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export declare const TagSpaceApi: { + _defaultBasePath: undefined; /** * Create a request builder for execution of post requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. diff --git a/test-packages/test-services-openapi/test-service/tag-space-api.js b/test-packages/test-services-openapi/test-service/tag-space-api.js index 4718dd23c7..48efb3f7a1 100644 --- a/test-packages/test-services-openapi/test-service/tag-space-api.js +++ b/test-packages/test-services-openapi/test-service/tag-space-api.js @@ -12,10 +12,11 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.TagSpaceApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of post requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - tagWithSpace: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/special-tag') + tagWithSpace: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/special-tag', {}, exports.TagSpaceApi._defaultBasePath) }; //# sourceMappingURL=tag-space-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/tag-space-api.js.map b/test-packages/test-services-openapi/test-service/tag-space-api.js.map index a96ed3715b..b1599ae72b 100644 --- a/test-packages/test-services-openapi/test-service/tag-space-api.js.map +++ b/test-packages/test-services-openapi/test-service/tag-space-api.js.map @@ -1 +1 @@ -{"version":3,"file":"tag-space-api.js","sourceRoot":"","sources":["tag-space-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB;;;OAGG;IACH,YAAY,EAAE,GAAG,EAAE,CACjB,IAAI,+BAAqB,CAAM,MAAM,EAAE,yBAAyB,CAAC;CACpE,CAAC"} \ No newline at end of file +{"version":3,"file":"tag-space-api.js","sourceRoot":"","sources":["tag-space-api.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,oDAA+D;AAC/D;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,gBAAgB,EAAE,SAAS;IAC3B;;;OAGG;IACH,YAAY,EAAE,GAAG,EAAE,CACjB,IAAI,+BAAqB,CACvB,MAAM,EACN,yBAAyB,EACzB,EAAE,EACF,mBAAW,CAAC,gBAAgB,CAC7B;CACJ,CAAC"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/tag-space-api.ts b/test-packages/test-services-openapi/test-service/tag-space-api.ts index 0fcc329b1e..a367e19128 100644 --- a/test-packages/test-services-openapi/test-service/tag-space-api.ts +++ b/test-packages/test-services-openapi/test-service/tag-space-api.ts @@ -9,10 +9,16 @@ import { OpenApiRequestBuilder } from '@sap-cloud-sdk/openapi'; * This API is part of the 'test-service' service. */ export const TagSpaceApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of post requests to the '/test-cases/special-tag' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ tagWithSpace: () => - new OpenApiRequestBuilder('post', '/test-cases/special-tag') + new OpenApiRequestBuilder( + 'post', + '/test-cases/special-tag', + {}, + TagSpaceApi._defaultBasePath + ) }; diff --git a/test-packages/test-services-openapi/test-service/test-case-api.d.ts b/test-packages/test-services-openapi/test-service/test-case-api.d.ts index 3de9d4871d..d94576383a 100644 --- a/test-packages/test-services-openapi/test-service/test-case-api.d.ts +++ b/test-packages/test-services-openapi/test-service/test-case-api.d.ts @@ -15,6 +15,7 @@ import type { * This API is part of the 'test-service' service. */ export declare const TestCaseApi: { + _defaultBasePath: undefined; /** * Create a request builder for execution of get requests to the '/test-cases/parameters/required-parameters/{requiredPathItemPathParam}' endpoint. * @param requiredPathItemPathParam - Path parameter. diff --git a/test-packages/test-services-openapi/test-service/test-case-api.js b/test-packages/test-services-openapi/test-service/test-case-api.js index cc5f82816d..9f7df71708 100644 --- a/test-packages/test-services-openapi/test-service/test-case-api.js +++ b/test-packages/test-services-openapi/test-service/test-case-api.js @@ -12,6 +12,7 @@ const openapi_1 = require("@sap-cloud-sdk/openapi"); * This API is part of the 'test-service' service. */ exports.TestCaseApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/parameters/required-parameters/{requiredPathItemPathParam}' endpoint. * @param requiredPathItemPathParam - Path parameter. @@ -23,7 +24,7 @@ exports.TestCaseApi = { pathParameters: { requiredPathItemPathParam }, body, queryParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/parameters/required-parameters/{requiredPathItemPathParam}' endpoint. * @param requiredPathItemPathParam - Path parameter. @@ -35,7 +36,7 @@ exports.TestCaseApi = { pathParameters: { requiredPathItemPathParam }, body, queryParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/parameters' endpoint. * @param queryParameters - Object containing the following keys: requiredQueryParam. @@ -45,7 +46,7 @@ exports.TestCaseApi = { testCaseRequiredQueryOptionalHeader: (queryParameters, headerParameters) => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/parameters', { queryParameters, headerParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/parameters' endpoint. * @param body - Request body. @@ -57,7 +58,7 @@ exports.TestCaseApi = { body, queryParameters, headerParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of patch requests to the '/test-cases/parameters' endpoint. * @param body - Request body. @@ -69,7 +70,7 @@ exports.TestCaseApi = { body, queryParameters, headerParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/parameters/{duplicateParam}' endpoint. * @param duplicateParam - Path parameter. @@ -79,27 +80,27 @@ exports.TestCaseApi = { testCaseGetDuplicateParameters: (duplicateParam, queryParameters) => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/parameters/{duplicateParam}', { pathParameters: { duplicateParam }, queryParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/duplicate-operation-ids' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - duplicateOperationId: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/duplicate-operation-ids'), + duplicateOperationId: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/duplicate-operation-ids', {}, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of put requests to the '/test-cases/duplicate-operation-ids' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - duplicateOperationId1_1: () => new openapi_1.OpenApiRequestBuilder('put', '/test-cases/duplicate-operation-ids'), + duplicateOperationId1_1: () => new openapi_1.OpenApiRequestBuilder('put', '/test-cases/duplicate-operation-ids', {}, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/duplicate-operation-ids' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - duplicateOperationId_1: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/duplicate-operation-ids'), + duplicateOperationId_1: () => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/duplicate-operation-ids', {}, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of patch requests to the '/test-cases/duplicate-operation-ids' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - duplicateOperationId1: () => new openapi_1.OpenApiRequestBuilder('patch', '/test-cases/duplicate-operation-ids'), + duplicateOperationId1: () => new openapi_1.OpenApiRequestBuilder('patch', '/test-cases/duplicate-operation-ids', {}, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/reserved-keywords/{const1}' endpoint. * @param const1 - Path parameter. @@ -109,7 +110,7 @@ exports.TestCaseApi = { export: (const1, queryParameters) => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/reserved-keywords/{const1}', { pathParameters: { const1 }, queryParameters - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/complex-schemas' endpoint. * @param body - Request body. @@ -117,7 +118,7 @@ exports.TestCaseApi = { */ complexSchemas: (body) => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/complex-schemas', { body - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of post requests to the '/test-cases/complex-schemas' endpoint. * @param body - Request body. @@ -125,7 +126,7 @@ exports.TestCaseApi = { */ useNameWithSymbols: (body) => new openapi_1.OpenApiRequestBuilder('post', '/test-cases/complex-schemas', { body - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/schema-name-integer' endpoint. * @param body - Request body. @@ -133,11 +134,11 @@ exports.TestCaseApi = { */ schemaNameInteger: (body) => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/schema-name-integer', { body - }), + }, exports.TestCaseApi._defaultBasePath), /** * Create a request builder for execution of get requests to the '/test-cases/no-operation-id' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ - getTestCasesNoOperationId: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/no-operation-id') + getTestCasesNoOperationId: () => new openapi_1.OpenApiRequestBuilder('get', '/test-cases/no-operation-id', {}, exports.TestCaseApi._defaultBasePath) }; //# sourceMappingURL=test-case-api.js.map \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/test-case-api.js.map b/test-packages/test-services-openapi/test-service/test-case-api.js.map index f1765e319e..80a212b474 100644 --- a/test-packages/test-services-openapi/test-service/test-case-api.js.map +++ b/test-packages/test-services-openapi/test-service/test-case-api.js.map @@ -1 +1 @@ -{"version":3,"file":"test-case-api.js","sourceRoot":"","sources":["test-case-api.ts"],"names":[],"mappings":"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"} \ No newline at end of file +{"version":3,"file":"test-case-api.js","sourceRoot":"","sources":["test-case-api.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/test-packages/test-services-openapi/test-service/test-case-api.ts b/test-packages/test-services-openapi/test-service/test-case-api.ts index 767a389d91..79d7358ea6 100644 --- a/test-packages/test-services-openapi/test-service/test-case-api.ts +++ b/test-packages/test-services-openapi/test-service/test-case-api.ts @@ -15,6 +15,7 @@ import type { * This API is part of the 'test-service' service. */ export const TestCaseApi = { + _defaultBasePath: undefined, /** * Create a request builder for execution of get requests to the '/test-cases/parameters/required-parameters/{requiredPathItemPathParam}' endpoint. * @param requiredPathItemPathParam - Path parameter. @@ -39,7 +40,8 @@ export const TestCaseApi = { pathParameters: { requiredPathItemPathParam }, body, queryParameters - } + }, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of post requests to the '/test-cases/parameters/required-parameters/{requiredPathItemPathParam}' endpoint. @@ -65,7 +67,8 @@ export const TestCaseApi = { pathParameters: { requiredPathItemPathParam }, body, queryParameters - } + }, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of get requests to the '/test-cases/parameters' endpoint. @@ -77,10 +80,15 @@ export const TestCaseApi = { queryParameters: { requiredQueryParam: string }, headerParameters?: { optionalHeaderParam?: string } ) => - new OpenApiRequestBuilder('get', '/test-cases/parameters', { - queryParameters, - headerParameters - }), + new OpenApiRequestBuilder( + 'get', + '/test-cases/parameters', + { + queryParameters, + headerParameters + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of post requests to the '/test-cases/parameters' endpoint. * @param body - Request body. @@ -93,11 +101,16 @@ export const TestCaseApi = { queryParameters: { optionalQueryParam?: string }, headerParameters: { requiredHeaderParam: string } ) => - new OpenApiRequestBuilder('post', '/test-cases/parameters', { - body, - queryParameters, - headerParameters - }), + new OpenApiRequestBuilder( + 'post', + '/test-cases/parameters', + { + body, + queryParameters, + headerParameters + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of patch requests to the '/test-cases/parameters' endpoint. * @param body - Request body. @@ -110,11 +123,16 @@ export const TestCaseApi = { queryParameters?: { optionalQueryParam?: string }, headerParameters?: { optionalHeaderParam?: string } ) => - new OpenApiRequestBuilder('patch', '/test-cases/parameters', { - body, - queryParameters, - headerParameters - }), + new OpenApiRequestBuilder( + 'patch', + '/test-cases/parameters', + { + body, + queryParameters, + headerParameters + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of get requests to the '/test-cases/parameters/{duplicateParam}' endpoint. * @param duplicateParam - Path parameter. @@ -131,7 +149,8 @@ export const TestCaseApi = { { pathParameters: { duplicateParam }, queryParameters - } + }, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of get requests to the '/test-cases/duplicate-operation-ids' endpoint. @@ -140,7 +159,9 @@ export const TestCaseApi = { duplicateOperationId: () => new OpenApiRequestBuilder( 'get', - '/test-cases/duplicate-operation-ids' + '/test-cases/duplicate-operation-ids', + {}, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of put requests to the '/test-cases/duplicate-operation-ids' endpoint. @@ -149,7 +170,9 @@ export const TestCaseApi = { duplicateOperationId1_1: () => new OpenApiRequestBuilder( 'put', - '/test-cases/duplicate-operation-ids' + '/test-cases/duplicate-operation-ids', + {}, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of post requests to the '/test-cases/duplicate-operation-ids' endpoint. @@ -158,7 +181,9 @@ export const TestCaseApi = { duplicateOperationId_1: () => new OpenApiRequestBuilder( 'post', - '/test-cases/duplicate-operation-ids' + '/test-cases/duplicate-operation-ids', + {}, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of patch requests to the '/test-cases/duplicate-operation-ids' endpoint. @@ -167,7 +192,9 @@ export const TestCaseApi = { duplicateOperationId1: () => new OpenApiRequestBuilder( 'patch', - '/test-cases/duplicate-operation-ids' + '/test-cases/duplicate-operation-ids', + {}, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of get requests to the '/test-cases/reserved-keywords/{const1}' endpoint. @@ -182,7 +209,8 @@ export const TestCaseApi = { { pathParameters: { const1 }, queryParameters - } + }, + TestCaseApi._defaultBasePath ), /** * Create a request builder for execution of get requests to the '/test-cases/complex-schemas' endpoint. @@ -190,31 +218,51 @@ export const TestCaseApi = { * @returns The request builder, use the `execute()` method to trigger the request. */ complexSchemas: (body: ComplexTestEntity | undefined) => - new OpenApiRequestBuilder('get', '/test-cases/complex-schemas', { - body - }), + new OpenApiRequestBuilder( + 'get', + '/test-cases/complex-schemas', + { + body + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of post requests to the '/test-cases/complex-schemas' endpoint. * @param body - Request body. * @returns The request builder, use the `execute()` method to trigger the request. */ useNameWithSymbols: (body: SimpleTestEntityWITHSymbols | undefined) => - new OpenApiRequestBuilder('post', '/test-cases/complex-schemas', { - body - }), + new OpenApiRequestBuilder( + 'post', + '/test-cases/complex-schemas', + { + body + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of get requests to the '/test-cases/schema-name-integer' endpoint. * @param body - Request body. * @returns The request builder, use the `execute()` method to trigger the request. */ schemaNameInteger: (body: Schema123456 | undefined) => - new OpenApiRequestBuilder('get', '/test-cases/schema-name-integer', { - body - }), + new OpenApiRequestBuilder( + 'get', + '/test-cases/schema-name-integer', + { + body + }, + TestCaseApi._defaultBasePath + ), /** * Create a request builder for execution of get requests to the '/test-cases/no-operation-id' endpoint. * @returns The request builder, use the `execute()` method to trigger the request. */ getTestCasesNoOperationId: () => - new OpenApiRequestBuilder('get', '/test-cases/no-operation-id') + new OpenApiRequestBuilder( + 'get', + '/test-cases/no-operation-id', + {}, + TestCaseApi._defaultBasePath + ) }; diff --git a/test-resources/openapi-service-specs/config/options-per-service.json b/test-resources/openapi-service-specs/config/options-per-service.json new file mode 100644 index 0000000000..41ea3d7ac2 --- /dev/null +++ b/test-resources/openapi-service-specs/config/options-per-service.json @@ -0,0 +1,15 @@ +{ + "../../test-resources/openapi-service-specs/specifications/no-schema-service.yml": { + "packageName": "no-schema-service", + "directoryName": "no-schema-service", + "basePath": "/base/path/to/service" + }, + "../../test-resources/openapi-service-specs/specifications/swagger-yaml-service.yml": { + "packageName": "swagger-yaml-service", + "directoryName": "swagger-yaml-service" + }, + "../../test-resources/openapi-service-specs/specifications/test-service.json": { + "packageName": "test-service", + "directoryName": "test-service" + } +} diff --git a/test-resources/openapi-service-specs/no-schema-service.yml b/test-resources/openapi-service-specs/specifications/no-schema-service.yml similarity index 100% rename from test-resources/openapi-service-specs/no-schema-service.yml rename to test-resources/openapi-service-specs/specifications/no-schema-service.yml diff --git a/test-resources/openapi-service-specs/swagger-yaml-service.yml b/test-resources/openapi-service-specs/specifications/swagger-yaml-service.yml similarity index 100% rename from test-resources/openapi-service-specs/swagger-yaml-service.yml rename to test-resources/openapi-service-specs/specifications/swagger-yaml-service.yml diff --git a/test-resources/openapi-service-specs/test-service.json b/test-resources/openapi-service-specs/specifications/test-service.json similarity index 100% rename from test-resources/openapi-service-specs/test-service.json rename to test-resources/openapi-service-specs/specifications/test-service.json