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-Typeagainst declared media types - Response media type validation — validates
Acceptheaders 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab171414421236f36218e36f034a6fb35193cb2feb7ea3e6a19175dc3d8fbf3d
|
|
| MD5 |
3f447293158f1eb92425344444cf4333
|
|
| BLAKE2b-256 |
983d63762c8471e6d262bedc35da8445a6ed17217a3f365d866bea5cba8e5485
|
File details
Details for the file intersystems_openapi3-0.1.0-py3-none-any.whl.
File metadata
- Download URL: intersystems_openapi3-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2217b73b142a3206c7706773f8b2d896e76669cb314786d727ebeebb4cd00a90
|
|
| MD5 |
a17b97231283a6730e21a895f30de034
|
|
| BLAKE2b-256 |
a08bafc22578b8397767055779f46255714e33a478eed78fdb89725e8cc7a4fb
|