Downloads20
Subscribe
0
Bookmark
4
This application is not supported by InterSystems Corporation. Please be notified that you use it at your own responsibility.
Details
Releases
Reviews
Awards
Issues
Articles

What's new in this version

  • Add application/xml media type support for code generation.

Gitter Quality Gate Status Reliability Rating

License: MIT

openapi-suite

This package gather a set of tools for ObjectScript code generation from Swagger specification 3.0.

It includes :

The following features are available :

  • Web interface to generate the code.
  • REST services to expose code generation.
  • Automatic conversion of Swagger specification 1.x or 2.x to version 3.x before processing (using swagger-converter-cli ).

OpenAPI-suite can generate code :

  • Simple HTTP client
  • Production client (with business services, processes and operation)
  • Server-side REST classes.

Installation ZPM

zpm "install openapi-suite"
; optional
zpm "install swagger-ui"

Installation docker

git clone git@github.com:lscalese/openapi-suite.git
cd openapi-suite
# in case of permission issue with iris-main.log
# touch iris-main.log && chmod 777 iris-main.log
docker-compose up -d

Note: It seems a problem could be occurs with BuildKit on Ubuntu.
In this case, you should use the compose plugin with the command docker compose up -d plugin instead of docker-compose up -d.
See the official documentation to instal compose plugin : Install the Compose plugin | Docker Documentation

Usage

Web interface

The UI is available at this address(*) http://localhost:52796/openapisuite/ui/index.csp

By default the feature Install On Server is disabled.
To enable, just :

Set ^openapisuite.config("web","enable-install-onserver") = 1

(*) Adapt the port number if needed

Swagger-ui

If you install swagger-ui, you can open http://localhost:52796/swagger-ui/index.html and explore http://localhost:52796/openapisuite/_spec to test REST services.

Generate by programming

All code snipets are available in the class dc.openapi.suite.samples.PetStore

Simple HTTP client

Set packageName = "petstoreclient"
Set features("simpleHttpClientOnly") = 1
Set sc = ##class(dc.openapi.client.Spec).generateApp(packageName, "https://petstore3.swagger.io/api/v3/openapi.json", .features)

Production client

Set packageName = "petstoreproduction"
Set sc = ##class(dc.openapi.client.Spec).generateApp(packageName, "https://petstore3.swagger.io/api/v3/openapi.json")

Rest server-side classes

Set packageName = "petstoreserver", webApplication = "/petstore/api"
Set sc = ##class(dc.openapi.server.ServerAppGenerator).Generate("petstoreserver", "https://petstore3.swagger.io/api/v3/openapi.json", webApplication)

Developer community article

More information about OpenAPI-suite are available on this developer community article.

IPM installation
zpm "install openapi-suite"
Rating
5 (1)
ObjectScript quality test
Passed
Updated on 01 April 2023
ObjectScript quality report
Category
Solutions
Works with
InterSystems IRIS
Tags
Info
Version
1.0.0
Last updated
2023-02-14
Repository
Open
Documentation
Open
License
Link