Skip to main content

Convert OpenAPI 3.0/3.1 specifications to LAPIS format

Project description

lapis-spec

Convert OpenAPI 3.0/3.1 specifications to LAPIS format.

LAPIS (Lightweight API Specification for Intelligent Systems) is a compact API description format designed for LLM consumption, achieving 70-80% token reduction compared to OpenAPI YAML.

Installation

pip install lapis-spec

Or with uv:

uv pip install lapis-spec

Usage

# Convert OpenAPI YAML to LAPIS
lapis -i openapi.yaml -o api.lapis

# Convert OpenAPI JSON to LAPIS
lapis -i openapi.json -o api.lapis

# Skip OpenAPI validation (useful for partial specs)
lapis -i openapi.yaml -o api.lapis --no-validate

CLI Options

Option Description
-i, --input Path to OpenAPI file (.json, .yaml, .yml)
-o, --output Path to output .lapis file
--no-validate Skip OpenAPI schema validation
--version Show version and exit
-h, --help Show help message

Supported Features

  • OpenAPI 3.0.x and 3.1.x
  • JSON and YAML input formats
  • Full $ref resolution
  • allOf/oneOf/anyOf flattening
  • All LAPIS sections: [meta], [types], [ops], [webhooks], [errors], [limits], [flows]
  • Automatic schema deduplication (inline vs named types)
  • Security scheme interpretation (bearer, apikey, basic, oauth2)
  • Operation modifier detection (+deprecated, +paginated, +idempotent, +stream)
  • Error response collection and deduplication

Development

# Install dependencies
poetry install

# Run tests
poetry run pytest

# Run tests with coverage report
poetry run pytest --cov-report=html

# Lint
poetry run ruff check src/ tests/

# Type check
poetry run mypy

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lapis_spec-0.1.0.tar.gz (74.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lapis_spec-0.1.0-py3-none-any.whl (26.8 kB view details)

Uploaded Python 3

File details

Details for the file lapis_spec-0.1.0.tar.gz.

File metadata

  • Download URL: lapis_spec-0.1.0.tar.gz
  • Upload date:
  • Size: 74.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for lapis_spec-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80338f1606cd7916412b20d4b2193b8b1e869275bf9417705f110d29a5ab9371
MD5 0acbc1e3dcd8d2c08f7318b1ab57817e
BLAKE2b-256 ae7a6e5f12c843fd0bd33fc8da9eb2784b9108dbf6bf0f81cbfd78f1d625a6dc

See more details on using hashes here.

File details

Details for the file lapis_spec-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lapis_spec-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for lapis_spec-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72bcbf8264483ceb32235ccbdd4df37eaca06f06e35f942f2db77443541bbcdd
MD5 c309aa5fb68a20360c21d1f83f4f46d5
BLAKE2b-256 819936181fd6e79dd5a29c590a7ca616233a92d9489ca67822b562ac3cbedaf4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page