Hello guys,
I have a few question regarding the open api specification for the Zoom Meetings API. I would like to build a node application with typescript that will use the Zoom Meetings API. I used this library: openapi-typescript-codegen
to generate the typescript services with this command: npx openapi --input ./ZoomMeetingAPIspec.json --output ./zoom-api
, where ZoomMeetingAPIspec.json
is the file I download for the meeting api.
The generation is successful but the typescript code has some issues in the types that are generated. For example:
public static reportTelephone(
from: string,
to: string,
type: 1 | 3 = '1',
queryDateType: 'start_time' | 'end_time' | 'meeting_start_time' | 'meeting_end_time' = 'start_time',
pageSize: number = 30,
pageNumber: number = 1,
nextPageToken?: string,
): CancelablePromise<{
...
You see the type argument has a 1 | 3 union type but the default value is string ‘1’
This is the reportTelephone
function in the ResponseService.ts
. I have concluded that this is happening because the open api specifications has this definition for the reportTelephone endpoint like this:
"/report/telephone": {
"get": {
"parameters": [
{
"description": "Audio types:<br>`1` - Toll-free Call-in & Call-out.<br>`2` - Toll <br>\n`3` - SIP Connected Audio",
"in": "query",
"name": "type",
"schema": { "default": "1", "enum": [1, 3], "type": "string", "example": "33" },
"x-enum-descriptions": ["Toll-free Call-in & Call-out"]
},
...
The schema for the type
parameter defines it an enum: [1, 3] of two integers, and then the default values is set as string “1”.
Any advice on what to do? In my opinion the specification file needs correction. But maybe there is workaround?