Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function generateTypesForDocument(definition: Document | string) {
const api = new OpenAPIClientAxios({ definition });
await api.init();
const processor = new WriteProcessor({ indentSize: 2, indentChar: ' ' });
const resolver = new ReferenceResolver();
const convertor = new SchemaConvertor(processor);
const rootSchema = await SwaggerParser.bundle(definition);
resolver.registerSchema(parseSchema(rootSchema));
const generator = new DtsGenerator(resolver, convertor);
const schemaTypes = await generator.generate();
const exportedTypes = convertor.getExports();
const operationTypings = generateOperationMethodTypings(api, exportedTypes);
const imports = [
'import {',
' OpenAPIClient,',
' Parameters,',
' UnknownParamsObject,',
' OperationResponse,',
' AxiosRequestConfig,',
`} from 'openapi-client-axios';`,
].join('\n');
return [imports, schemaTypes, operationTypings];
}
export async function generateTypesForDocument(definition: Document | string) {
const api = new OpenAPIClientAxios({ definition });
await api.init();
const processor = new WriteProcessor({ indentSize: 2, indentChar: ' ' });
const resolver = new ReferenceResolver();
const convertor = new SchemaConvertor(processor);
const rootSchema = await SwaggerParser.bundle(definition);
resolver.registerSchema(parseSchema(rootSchema));
const generator = new DtsGenerator(resolver, convertor);
const schemaTypes = await generator.generate();
const exportedTypes = convertor.getExports();
const operationTypings = generateOperationMethodTypings(api, exportedTypes);
const imports = [
'import {',
' OpenAPIClient,',
' Parameters,',
' UnknownParamsObject,',
' OperationResponse,',
' AxiosRequestConfig,',
`} from 'openapi-client-axios';`,
].join('\n');
export async function generateTypesForDocument(definition: Document | string) {
const api = new OpenAPIClientAxios({ definition });
await api.init();
const processor = new WriteProcessor({ indentSize: 2, indentChar: ' ' });
const resolver = new ReferenceResolver();
const convertor = new SchemaConvertor(processor);
const rootSchema = await SwaggerParser.bundle(definition);
resolver.registerSchema(parseSchema(rootSchema));
const generator = new DtsGenerator(resolver, convertor);
const schemaTypes = await generator.generate();
const exportedTypes = convertor.getExports();
const operationTypings = generateOperationMethodTypings(api, exportedTypes);
const imports = [
'import {',
' OpenAPIClient,',
' Parameters,',
' UnknownParamsObject,',
' OperationResponse,',
export async function generateTypesForDocument(definition: Document | string) {
const api = new OpenAPIClientAxios({ definition });
await api.init();
const processor = new WriteProcessor({ indentSize: 2, indentChar: ' ' });
const resolver = new ReferenceResolver();
const convertor = new SchemaConvertor(processor);
const rootSchema = await SwaggerParser.bundle(definition);
resolver.registerSchema(parseSchema(rootSchema));
const generator = new DtsGenerator(resolver, convertor);
const schemaTypes = await generator.generate();
const exportedTypes = convertor.getExports();
const operationTypings = generateOperationMethodTypings(api, exportedTypes);
const imports = [
'import {',
' OpenAPIClient,',
' Parameters,',
' UnknownParamsObject,',
' OperationResponse,',
' AxiosRequestConfig,',
export async function generateTypesForDocument(definition: Document | string) {
const api = new OpenAPIClientAxios({ definition });
await api.init();
const processor = new WriteProcessor({ indentSize: 2, indentChar: ' ' });
const resolver = new ReferenceResolver();
const convertor = new SchemaConvertor(processor);
const rootSchema = await SwaggerParser.bundle(definition);
resolver.registerSchema(parseSchema(rootSchema));
const generator = new DtsGenerator(resolver, convertor);
const schemaTypes = await generator.generate();
const exportedTypes = convertor.getExports();
const operationTypings = generateOperationMethodTypings(api, exportedTypes);
const imports = [
'import {',
' OpenAPIClient,',
' Parameters,',
' UnknownParamsObject,',