Skip to content

Commit

Permalink
refactor: rename /openapi -> /openapi.json (#631)
Browse files Browse the repository at this point in the history
Recently, we created new endpoints:

`/v2/acts/:actorId/builds/:buildId/openapi-specification`
`/v2/actor-builds/:buildId/openapi-specification`
Than we've received a feedback to rename endpoints to `/openapi.json`.

**This PR renames OpenAPI endpoints from `*/openapi-specification` to
`*/openapi.json`*

More context
[here](https://apify.slack.com/archives/C01VBUV81UZ/p1737975106009729)
  • Loading branch information
danpoletaev authored Jan 28, 2025
1 parent 4976658 commit 379830f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/resource_clients/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ export class BuildClient extends ResourceClient {
/**
* https://docs.apify.com/api/v2/actor-build-openapi-specification-get
*/
async getOpenApiSpecification(): Promise<OpenApiSpecification> {
async getOpenApiDefinition(): Promise<OpenApiDefinition> {
const response = await this.httpClient.call({
url: this._url('openapi-specification'),
url: this._url('openapi.json'),
method: 'GET',
params: this._params(),
});
Expand Down Expand Up @@ -156,7 +156,7 @@ export interface BuildOptions {
diskMbytes?: number;
}

export interface OpenApiSpecification {
export interface OpenApiDefinition {
openapi: string;
info: {
title: string
Expand Down
8 changes: 4 additions & 4 deletions test/builds.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ describe('Build methods', () => {
validateRequest({}, { buildId });
});

test('getOpenApiSpecification() works', async () => {
test('getOpenApiDefinition() works', async () => {
const buildId = 'some-build-id';

const res = await client.build(buildId).getOpenApiSpecification();
expect(res.data.id).toEqual('build-openapi-specification');
const res = await client.build(buildId).getOpenApiDefinition();
expect(res.data.id).toEqual('build-openapi');
validateRequest({}, { buildId });

const browserRes = await page.evaluate((bId) => client.build(bId).getOpenApiSpecification(), buildId);
const browserRes = await page.evaluate((bId) => client.build(bId).getOpenApiDefinition(), buildId);
expect(browserRes).toEqual(res);
validateRequest({}, { buildId });
});
Expand Down
2 changes: 1 addition & 1 deletion test/mock_server/routes/builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ROUTES = [
{ id: 'get-build', method: 'GET', path: '/:buildId', type: 'responseJsonMock' },
{ id: 'abort-build', method: 'POST', path: '/:buildId/abort' },
{ id: 'build-log', method: 'GET', path: '/:buildId/log', type: 'text' },
{ id: 'build-openapi-specification', method: 'GET', path: '/:buildId/openapi-specification', type: 'responseJsonMock' },
{ id: 'build-openapi', method: 'GET', path: '/:buildId/openapi.json', type: 'responseJsonMock' },
];

addRoutes(builds, ROUTES);
Expand Down

0 comments on commit 379830f

Please sign in to comment.