Socket
Book a DemoInstallSign in
Socket

@basketry/ir

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@basketry/ir

Low-level Basketry IR components

0.2.1
latest
Source
npmnpm
Version published
Weekly downloads
402
24.84%
Maintainers
1
Weekly downloads
 
Created
Source

main main

Basketry Intermediate Representation (IR)

This package defines the formal Basketry Intermediate Representation format.

View the human-readable documentation at basketry.io/docs/specification/v0.2.

Overview

The Basketry Intermediate Representation (IR) is the shared data model that connects all Basketry components. Every Basketry pipeline passes data in this format, making the IR the single source of truth for how services, methods, types, etc are represented. The IR is defined in an authoritative JSON Schema and serves as the foundation for the entire Basketry ecosystem.

Use the types

Types can be imported from package:

import { Service } from '@basketry/ir';

function doSomething(service: Service): void {
  // TODO: Do something with the service
}

Validate IR

For tooling that produces IR (like a Parser), you can use the validate method to ensure your IR conforms to the schema:

import { validate } from '@basketry/ir';

const ir: any = {
  // TODO: Define a service object
};

// `service` will be a valid Service or `undefined`
// `errors` is an array of any errors
const { service, errors } = validate(ir);

Import the schema

The raw JSON Schema is also included in the package:

import schema from '@basketry/ir/lib/schema.json';

// TODO: Do something with the schema

Use Cases

Documentation

The IR’s JSON Schema also serves as the source for the published specification at basketry.io/docs/specification/v0.2. This documentation is generated directly from the schema, ensuring it’s always in sync with the actual contract used by Basketry core and its components. Contributors updating the schema can automatically update the public-facing spec, making it a reliable reference for anyone building with or on top of Basketry.

Parsers

Parsers are responsible for converting human-oriented service definition formats (like OpenAPI, JSON Schema, or other SDLs) into the Basketry IR. With the authoritative JSON Schema as a guide, parser authors can ensure their output matches the IR exactly, making it immediately compatible with any generator or rule in the ecosystem. This reduces the need for format-specific generators and encourages a healthy, shared tooling ecosystem.

Rules

Rules act as automated reviewers, inspecting the IR to enforce architectural, style, or compliance guidelines. By working against the IR, rules can be applied universally, regardless of the original service definition format. This allows organizations to maintain high standards across diverse APIs and tech stacks, with validation that’s both consistent and easy to maintain.

Generators

Generators take the IR as input and produce tangible outputs — code, documentation, SDKs, tests, or anything else that can be derived from a service definition. Because the IR is consistent and language-agnostic, generator authors can focus entirely on producing quality output without worrying about inconsistencies in the input.

For contributors:

Run this project

  • Clone this repo
  • Install packages: npm ci
  • Generate types: npx basketry
  • Build the code: npm run build

Note that the lint script is run prior to build. Auto-fixable linting or formatting errors may be fixed by running npm run fix.

Create and run tests

  • Add tests by creating files with the .test.ts suffix
  • Run the tests: npm t
  • Test coverage can be viewed at /coverage/lcov-report/index.html

Publish a new package version

  • Create new version
    • Navigate to the version workflow from the Actions tab.
    • Manually dispatch the action with the appropriate inputs
    • This will create a PR with the new version
  • Publish to NPM
    • Review and merge the PR
    • The publish workflow will create a git tag and publish the package on NPM

FAQs

Package last updated on 23 Aug 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.