// module to create typescript types from query param lists. Based on // input in this GitHub issue: // https://github.com/ThomasAribart/json-schema-to-ts/issues/82 import { FromSchema, JSONSchema } from 'json-schema-to-ts'; import { O, L, A } from 'ts-toolbelt'; type OpenApiParam = { readonly name: string; readonly schema: JSONSchema; // Parameter types: // https://swagger.io/docs/specification/describing-parameters/#types readonly in: 'query' | 'path' | 'header' | 'cookie'; }; type RecurseOnParams< P extends readonly OpenApiParam[], R extends O.Object = {}, > = { continue: RecurseOnParams< L.Tail
, L.Head
['in'] extends 'query' ? R & { [key in L.Head
['name']]: FromSchema =
RecurseOnParams ;