Skip to content

Commit

Permalink
refactor: rename /openapi -> /openapi.json
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoletaev committed Jan 27, 2025
1 parent 4976658 commit 93c481b
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<OpenApiSchema> {
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 OpenApiSchema {
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 93c481b

Please sign in to comment.