Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@devup-api/generator

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devup-api/generator

npmnpm
Version
0.1.5
Version published
Maintainers
1
Created
Source

@devup-api/generator

TypeScript interface generator from OpenAPI schemas.

Installation

npm install @devup-api/generator

Exports

  • generateInterface(schema: OpenAPIV3_1.Document, options?: DevupApiTypeGeneratorOptions): string - Generate TypeScript interface definitions from OpenAPI schema
  • createUrlMap(schema: OpenAPIV3_1.Document, options?: DevupApiTypeGeneratorOptions): Record<string, UrlMapValue> - Create URL map from OpenAPI schema

Usage

Generate TypeScript Interfaces

import { generateInterface } from '@devup-api/generator'
import { readOpenapiAsync } from '@devup-api/utils'

const schema = await readOpenapiAsync('openapi.json')
const interfaceCode = generateInterface(schema, {
  convertCase: 'camel',
  responseDefaultNonNullable: true
})

// Write to file
await writeFile('api.d.ts', interfaceCode)

Create URL Map

import { createUrlMap } from '@devup-api/generator'
import { readOpenapiAsync } from '@devup-api/utils'

const schema = await readOpenapiAsync('openapi.json')
const urlMap = createUrlMap(schema, {
  convertCase: 'camel'
})

// urlMap will contain entries like:
// {
//   'getUsers': { method: 'GET', url: '/users' },
//   '/users': { method: 'GET', url: '/users' }
// }

Options

interface DevupApiTypeGeneratorOptions {
  convertCase?: 'snake' | 'camel' | 'pascal' | 'maintain'
  requestDefaultNonNullable?: boolean
  responseDefaultNonNullable?: boolean
}

License

Apache 2.0

FAQs

Package last updated on 01 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts