🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@isl-lang/codegen

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isl-lang/codegen

ISL code generators - umbrella package for all code generation targets

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@isl-lang/codegen

ISL code generators - umbrella package for all code generation targets.

Installation

npm install @isl-lang/codegen

For individual generators (better tree-shaking):

npm install @isl-lang/codegen-python
npm install @isl-lang/codegen-openapi
npm install @isl-lang/codegen-graphql

Usage

import { generatePython, generateOpenAPI, generateGraphQL } from '@isl-lang/codegen';
import { parse } from '@isl-lang/parser';

const ast = parse(`
  domain UserAPI {
    type User {
      id: uuid
      name: string
      email: email
    }

    intent CreateUser {
      input { name: string, email: email }
      output { user: User }
    }
  }
`);

// Generate Python (Pydantic + FastAPI)
const pythonCode = generatePython(ast, {
  framework: 'fastapi',
  pydantic: 'v2',
});

// Generate OpenAPI 3.1 spec
const openapi = generateOpenAPI(ast, {
  info: { title: 'User API', version: '1.0.0' },
});

// Generate GraphQL schema
const graphql = generateGraphQL(ast);

Available Generators

GeneratorPackageDescription
Python@isl-lang/codegen-pythonPydantic models, FastAPI/Flask endpoints
OpenAPI@isl-lang/codegen-openapiOpenAPI 3.1 specifications
GraphQL@isl-lang/codegen-graphqlGraphQL schemas and resolvers
TypeScript@isl-lang/codegen-typesTypeScript types and interfaces
Rust@isl-lang/codegen-rustRust structs with serde
Go@isl-lang/codegen-goGo structs and handlers
Validators@isl-lang/codegen-validatorsRuntime validators
Tests@isl-lang/codegen-testsTest cases from contracts
Mocks@isl-lang/codegen-mocksMock implementations
Docs@isl-lang/codegen-docsDocumentation generation

Subpath Imports

For better tree-shaking, use subpath imports:

// Only imports Python generator
import { generatePython } from '@isl-lang/codegen/python';

// Only imports OpenAPI generator
import { generateOpenAPI } from '@isl-lang/codegen/openapi';

CLI Usage

# Via the ISL CLI
isl generate --target python specs/

# Multiple targets
isl generate --target typescript,openapi specs/

Configuration

Generators accept options for customization:

// Python options
generatePython(ast, {
  framework: 'fastapi' | 'flask' | 'django',
  pydantic: 'v1' | 'v2',
  asyncMode: true,
  outputDir: './src/generated',
});

// OpenAPI options
generateOpenAPI(ast, {
  info: { title: 'My API', version: '1.0.0' },
  servers: [{ url: 'https://api.example.com' }],
  security: [{ bearerAuth: [] }],
});

// TypeScript options
generateTypeScript(ast, {
  runtime: true,  // Include runtime validators
  zod: true,      // Generate Zod schemas
  strict: true,   // Strict TypeScript
});

Documentation

Full documentation: https://isl-lang.dev/docs/codegen

License

MIT

Keywords

isl

FAQs

Package last updated on 11 Feb 2026

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