Skip to content

Commit

Permalink
Update zoom spec (#574)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Rico <[email protected]>
  • Loading branch information
SferaDev authored Nov 27, 2024
1 parent 31ee058 commit c62c402
Show file tree
Hide file tree
Showing 8 changed files with 25,641 additions and 56,144 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-kings-yawn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'zoom-api-js': patch
---

Update spec
13 changes: 7 additions & 6 deletions packages/zoom-api-js/openapi-codegen.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import Case from "case";
export default defineConfig({
meeting: {
from: {
source: 'file',
relativePath: "specs/meeting.yml"
source: 'url',
url: "https://developers.zoom.us/api-hub/meetings/methods/endpoints.json"
},
outputDir: 'src/meeting',
to: async (context) => {
const filenamePrefix = '';

// Add missing operation ids
context.openAPIDocument = addOperationIds({ openAPIDocument: context.openAPIDocument });
// Add missing operation ids and clean them
context.openAPIDocument = cleanOperationIds({ openAPIDocument: context.openAPIDocument });

const { schemasFiles } = await generateSchemaTypes(context, { filenamePrefix });
await generateFetchers(context, { filenamePrefix, schemasFiles });
Expand All @@ -26,17 +26,18 @@ export default defineConfig({
}
});

function addOperationIds({
function cleanOperationIds({
openAPIDocument,
}: {
openAPIDocument: Context['openAPIDocument'];
}) {
for (const [key, path] of Object.entries(openAPIDocument.paths as Record<string, PathItemObject>)) {
for (const method of ["get", "put", "post", "patch", "delete"] as const) {
if (path[method]) {
const operationId = path[method].operationId ?? `${method} ${key}`;
openAPIDocument.paths[key][method] = {
...openAPIDocument.paths[key][method],
operationId: Case.camel(`${method} ${key}`)
operationId: Case.camel(operationId)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/zoom-api-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"scripts": {
"tsc": "tsc --noEmit",
"build": "rimraf dist && tsup",
"pregenerate": "pnpm dlx postman-to-openapi ./specs/meeting.json > ./specs/meeting.yml",
"generate": "openapi-codegen meeting"
},
"repository": {
Expand All @@ -36,7 +35,6 @@
},
"devDependencies": {
"case": "^1.6.3",
"openapi3-ts": "^4.4.0",
"postman-to-openapi": "^3.0.1"
"openapi3-ts": "^4.4.0"
}
}
Loading

0 comments on commit c62c402

Please sign in to comment.