(openapiJson:any)
| 30 | return result; |
| 31 | }; |
| 32 | const getFirstMethodAndEndpoint = (openapiJson:any) => { |
| 33 | if (!openapiJson || !openapiJson.paths || !openapiJson.servers) { |
| 34 | return null; |
| 35 | } |
| 36 | const baseUrl = openapiJson.servers[0].url; |
| 37 | const paths = Object.keys(openapiJson.paths); |
| 38 | |
| 39 | if (paths.length === 0) { |
| 40 | return null; |
| 41 | } |
| 42 | |
| 43 | const firstPath = paths[0]; |
| 44 | const methods = openapiJson.paths[firstPath]; |
| 45 | const firstMethod = Object.keys(methods)[0]; |
| 46 | |
| 47 | return { |
| 48 | method: firstMethod.toUpperCase(), |
| 49 | endpoint: baseUrl + firstPath |
| 50 | }; |
| 51 | } |
| 52 | const formatTimestamp = (timestamp:number) => { |
| 53 | const date = new Date(timestamp); |
| 54 | const options: Intl.DateTimeFormatOptions = { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: false,month: 'short', day: 'numeric', year: 'numeric' }; |
no outgoing calls
no test coverage detected