({ endpoint, errors, group, mergedAnnotations, middleware, payloads, successes })
| 319 | spec.tags.push(tag) |
| 320 | }, |
| 321 | onEndpoint({ endpoint, errors, group, mergedAnnotations, middleware, payloads, successes }) { |
| 322 | if (Context.get(mergedAnnotations, Exclude)) { |
| 323 | return |
| 324 | } |
| 325 | let op: OpenAPISpecOperation = { |
| 326 | tags: [Context.getOrElse(group.annotations, Title, () => group.identifier)], |
| 327 | operationId: Context.getOrElse( |
| 328 | endpoint.annotations, |
| 329 | Identifier, |
| 330 | () => group.topLevel ? endpoint.name : `${group.identifier}.${endpoint.name}` |
| 331 | ), |
| 332 | parameters: [], |
| 333 | security: [], |
| 334 | responses: {} |
| 335 | } |
| 336 | |
| 337 | function processResponseMap( |
| 338 | map: ReadonlyMap<number, { |
| 339 | readonly ast: Option.Option<AST.AST> |
| 340 | readonly description: Option.Option<string> |
| 341 | }>, |
| 342 | defaultDescription: () => string |
| 343 | ) { |
| 344 | for (const [status, { ast, description }] of map) { |
| 345 | if (op.responses[status]) continue |
| 346 | op.responses[status] = { |
| 347 | description: Option.getOrElse(description, defaultDescription) |
| 348 | } |
| 349 | ast.pipe( |
| 350 | Option.filter((ast) => !HttpApiSchema.getEmptyDecodeable(ast)), |
| 351 | Option.map((ast) => { |
| 352 | const encoding = HttpApiSchema.getEncoding(ast) |
| 353 | op.responses[status].content = { |
| 354 | [encoding.contentType]: { |
| 355 | schema: processAST(ast) |
| 356 | } |
| 357 | } |
| 358 | }) |
| 359 | ) |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | function processParameters(schema: Option.Option<Schema.Schema.All>, i: OpenAPISpecParameter["in"]) { |
| 364 | if (Option.isSome(schema)) { |
| 365 | const jsonSchema = processAST(schema.value.ast) |
| 366 | if ("properties" in jsonSchema) { |
| 367 | Object.entries(jsonSchema.properties).forEach(([name, psJsonSchema]) => { |
| 368 | op.parameters.push({ |
| 369 | name, |
| 370 | in: i, |
| 371 | schema: psJsonSchema, |
| 372 | required: jsonSchema.required.includes(name), |
| 373 | ...(psJsonSchema.description !== undefined ? { description: psJsonSchema.description } : undefined) |
| 374 | }) |
| 375 | }) |
| 376 | } |
| 377 | } |
| 378 | } |
nothing calls this directly
no test coverage detected