( pathItem: PathItemObject, operation: OperationObject, r: DocResolver, )
| 63 | // --------------------------------------------------------------------------- |
| 64 | |
| 65 | const extractParameters = ( |
| 66 | pathItem: PathItemObject, |
| 67 | operation: OperationObject, |
| 68 | r: DocResolver, |
| 69 | ): OperationParameter[] => { |
| 70 | const merged = new Map<string, ParameterObject>(); |
| 71 | |
| 72 | for (const raw of pathItem.parameters ?? []) { |
| 73 | const p = r.resolve<ParameterObject>(raw); |
| 74 | if (!p) continue; |
| 75 | merged.set(`${p.in}:${p.name}`, p); |
| 76 | } |
| 77 | for (const raw of operation.parameters ?? []) { |
| 78 | const p = r.resolve<ParameterObject>(raw); |
| 79 | if (!p) continue; |
| 80 | merged.set(`${p.in}:${p.name}`, p); |
| 81 | } |
| 82 | |
| 83 | return [...merged.values()] |
| 84 | .filter((p) => VALID_PARAM_LOCATIONS.has(p.in)) |
| 85 | .map((p) => |
| 86 | OperationParameter.make({ |
| 87 | name: p.name, |
| 88 | location: p.in as ParameterLocation, |
| 89 | required: p.in === "path" ? true : p.required === true, |
| 90 | schema: Option.fromNullishOr(p.schema), |
| 91 | style: Option.fromNullishOr(p.style), |
| 92 | explode: Option.fromNullishOr(p.explode), |
| 93 | allowReserved: Option.fromNullishOr("allowReserved" in p ? p.allowReserved : undefined), |
| 94 | description: Option.fromNullishOr(p.description), |
| 95 | }), |
| 96 | ); |
| 97 | }; |
| 98 | |
| 99 | // --------------------------------------------------------------------------- |
| 100 | // Request body extraction |
no test coverage detected