( operation: IHttpOperation, transformValues: ValuesTransformer = identity )
| 23 | import { ValuesTransformer } from './colorizer'; |
| 24 | |
| 25 | export function createExamplePath( |
| 26 | operation: IHttpOperation, |
| 27 | transformValues: ValuesTransformer = identity |
| 28 | ): E.Either<Error, string> { |
| 29 | return pipe( |
| 30 | E.Do, |
| 31 | E.bind('pathData', () => generateTemplateAndValuesForPathParams(operation)), |
| 32 | E.bind('queryData', ({ pathData }) => generateTemplateAndValuesForQueryParams(pathData.template, operation)), |
| 33 | E.map(({ pathData, queryData }) => |
| 34 | URI.expand(queryData.template, transformValues({ ...pathData.values, ...queryData.values })) |
| 35 | ), |
| 36 | E.map(path => path.replace(/\?$/, '')) |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | function generateParamValue(spec: IHttpParam): E.Either<Error, unknown> { |
| 41 | return pipe( |
no test coverage detected