Skip to main content

OpenAPIv3.1 REST backend generator for InterSystems IRIS

Project description

intersystems_openapi3

A CLI tool that generates InterSystems IRIS CSP REST backend classes from an OpenAPI 3.1.x specification. Point it at a valid JSON spec and it produces two ready-to-import ObjectScript class files — a dispatch class that handles routing and validation, and an implementation stub where you fill in the business logic.

Requirements

  • Python 3.10+
  • A valid OpenAPI 3.1.x spec in JSON format

Installation

pip install intersystems_openapi3

Usage

Generate classes from a spec (output alongside the spec file):

intersystems_openapi3 /path/to/spec.json

Write output to a specific directory:

intersystems_openapi3 /path/to/spec.json -o /path/to/output/

Use a custom name for the generated classes:

intersystems_openapi3 /path/to/spec.json -n MyRestService

Other flags:

intersystems_openapi3 --version
intersystems_openapi3 --help

Output

Two ObjectScript class files are generated in the output directory:

File Description
{MyRestService}.disp.cls Dispatch class — handles URL routing, parameter validation, request body checks, and Accept header validation. Do not edit.
{MyRestService}.impl.cls Implementation class — one stub method per operation. Add your business logic here.

Import both files into your InterSystems IRIS instance to set up the REST API.

What gets generated

For each operation in the spec, the tool produces:

  • Typed method signatures — parameters are annotated with ObjectScript types derived from the OpenAPI schema (%String, %Integer, %Float, %Boolean)
  • Parameter validation — enforces constraints such as minLength, maxLength, pattern, minimum, maximum, and format-specific bounds (int32, int64)
  • Request body handling — validates that required bodies are present and checks Content-Type against declared media types
  • Response media type validation — validates Accept headers against declared response schemas
  • Auto-assigned operation IDs — if your spec omits operationId, one is generated from the HTTP method and path

Example

Given a spec with a GET /users/{id} operation, the tool generates a dispatch method that validates the id path parameter and calls through to an implementation stub:

/// GET /users/{id}
ClassMethod GetUsersId(id As %String) As %Status
{
    // Add your business logic here
    Quit $$$OK
}

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

intersystems_openapi3-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

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

intersystems_openapi3-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intersystems_openapi3-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for intersystems_openapi3-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ab171414421236f36218e36f034a6fb35193cb2feb7ea3e6a19175dc3d8fbf3d
MD5 3f447293158f1eb92425344444cf4333
BLAKE2b-256 983d63762c8471e6d262bedc35da8445a6ed17217a3f365d866bea5cba8e5485

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for intersystems_openapi3-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2217b73b142a3206c7706773f8b2d896e76669cb314786d727ebeebb4cd00a90
MD5 a17b97231283a6730e21a895f30de034
BLAKE2b-256 a08bafc22578b8397767055779f46255714e33a478eed78fdb89725e8cc7a4fb

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