( schema: OpenAPIV3.SchemaObject, parameters: Record<string, unknown>, )
| 218 | } |
| 219 | |
| 220 | function buildBody( |
| 221 | schema: OpenAPIV3.SchemaObject, |
| 222 | parameters: Record<string, unknown>, |
| 223 | ): { [x: string]: any } { |
| 224 | const properties = schema.properties as { |
| 225 | [name: string]: OpenAPIV3_1.SchemaObject; |
| 226 | }; |
| 227 | console.log("properties:", JSON.stringify(properties)); |
| 228 | |
| 229 | const bodyArray = Object.entries(properties).map(([name, property]) => { |
| 230 | // Throw out readonly attributes |
| 231 | if (property.readOnly) return undefined; |
| 232 | const paramValue = getParam(parameters, name); |
| 233 | if (paramValue) { |
| 234 | return { [name]: paramValue }; |
| 235 | } |
| 236 | }); |
| 237 | return Object.assign({}, ...bodyArray); |
| 238 | } |
| 239 | |
| 240 | export async function makeHttpRequest( |
| 241 | url: string, |
no test coverage detected