(root: UnknownRecord, value: unknown)
| 85 | } |
| 86 | |
| 87 | function resolveRef(root: UnknownRecord, value: unknown): unknown { |
| 88 | if (!isRecord(value) || typeof value.$ref !== 'string') |
| 89 | return value |
| 90 | if (!value.$ref.startsWith('#/')) |
| 91 | return value |
| 92 | |
| 93 | return ( |
| 94 | value.$ref |
| 95 | .slice(2) |
| 96 | .split('/') |
| 97 | .reduce<unknown>((current, segment) => { |
| 98 | if (!isRecord(current)) |
| 99 | return undefined |
| 100 | return current[segment.replace(/~1/g, '/').replace(/~0/g, '~')] |
| 101 | }, root) ?? value |
| 102 | ) |
| 103 | } |
| 104 | |
| 105 | function openApiTemplateToVariables(value: string): string { |
| 106 | return value |
no test coverage detected