Skip to content

Commit

Permalink
Merge pull request #36 from event-catalog/change-to-return-types-of-g…
Browse files Browse the repository at this point in the history
…et-specs-for-services

chore(sdk): changed the return type for getting specs for a service
  • Loading branch information
boyney123 authored Sep 27, 2024
2 parents 5f874c4 + 287912f commit 34cd531
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-poets-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@eventcatalog/sdk": patch
---

chore(sdk): changed the return type for getting specs for a service
2 changes: 1 addition & 1 deletion src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export const getSpecificationFilesForService = (directory: string) => async (id:
}
const rawFile = await getFileFromResource(directory, id, { fileName }, version);

return { [specFile]: { content: rawFile, fileName: fileName, path: join(dirname(filePathToService), fileName) } };
return { key: specFile, content: rawFile, fileName: fileName, path: join(dirname(filePathToService), fileName) };
});

specs = await Promise.all(getSpecs);
Expand Down
18 changes: 8 additions & 10 deletions src/test/services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,11 +633,10 @@ describe('Services SDK', () => {

expect(specFiles).toEqual([
{
asyncapiPath: {
content: 'fake-async-api-file',
fileName: 'spec.yaml',
path: expect.stringContaining('/services/AccountService/spec.yaml'),
},
content: 'fake-async-api-file',
fileName: 'spec.yaml',
path: expect.stringContaining('/services/AccountService/spec.yaml'),
key: 'asyncapiPath',
},
]);
});
Expand All @@ -662,11 +661,10 @@ describe('Services SDK', () => {

expect(specFiles).toEqual([
{
asyncapiPath: {
content: 'fake-async-api-file',
fileName: 'spec.yaml',
path: expect.stringContaining('/services/AccountService/versioned/0.0.1/spec.yaml'),
},
content: 'fake-async-api-file',
fileName: 'spec.yaml',
path: expect.stringContaining('/services/AccountService/versioned/0.0.1/spec.yaml'),
key: 'asyncapiPath',
},
]);
});
Expand Down

0 comments on commit 34cd531

Please sign in to comment.