diff --git a/frontend_src/vstutils/views/ViewConstructor.js b/frontend_src/vstutils/views/ViewConstructor.js index 0e9d16da..91074b40 100644 --- a/frontend_src/vstutils/views/ViewConstructor.js +++ b/frontend_src/vstutils/views/ViewConstructor.js @@ -279,10 +279,11 @@ export default class ViewConstructor { }; if (!isEmpty) { operationOptions.action = params; + operationOptions.title = params.title; const view = new ActionView(operationOptions, null); const executeAction = { ...this.dictionary.paths.operations.action.execute, - title: operationOptions[ACTION_NAME] || operationOptions.title, + title: operationOptions[ACTION_NAME] || params.title, confirmationRequired, isFileResponse, }; diff --git a/frontend_src/vstutils/views/__tests__/actions-generation.test.js b/frontend_src/vstutils/views/__tests__/actions-generation.test.js index 33b402fb..8c0e21ff 100644 --- a/frontend_src/vstutils/views/__tests__/actions-generation.test.js +++ b/frontend_src/vstutils/views/__tests__/actions-generation.test.js @@ -12,4 +12,37 @@ describe('ViewConstructor', () => { expect(app.views.get('/user/{id}/disable/')).toBeUndefined(); expect(app.views.get('/user/{id}/').actions.get('disable')).toBeTruthy(); }); + + test('x-title will be used as action label and view title', async () => { + const app = await createApp({ + schema: createSchema({ + paths: { + '/user/{id}/some_action/': { + parameters: [{ name: 'id', in: 'path', required: true, type: 'integer' }], + post: { + operationId: 'user_some_action', + parameters: [ + { + name: 'data', + in: 'body', + required: true, + schema: { $ref: '#/definitions/User' }, + }, + ], + responses: { + 200: { + schema: { $ref: '#/definitions/User' }, + }, + }, + 'x-title': 'Customized label', + }, + }, + }, + }), + }); + + const view = app.views.get('/user/{id}/some_action/'); + expect(view.actions.get('execute').title).toBe('Customized label'); + expect(view.getTitle()).toBe('Customized label'); + }); }); diff --git a/vstutils/__init__.py b/vstutils/__init__.py index a311a9a0..b599cc3c 100644 --- a/vstutils/__init__.py +++ b/vstutils/__init__.py @@ -1,2 +1,2 @@ # pylint: disable=django-not-available -__version__: str = '5.8.14' +__version__: str = '5.8.15'