Jason Williams (Progress Software) asked a question.
The OpenAPI Specification (formerly known as the Swagger Specification) describes RESTful Web Services. The specification can be used to generate client and server programs as well as documenting the services.
The Data Service Catalog describes the prescriptive REST API in OpenEdge Data Services. This REST API is used by JSDO-based clients to access the OpenEdge backend.
This sample program takes a catalog JSON file as input and generates an OpenAPI Specification file that can be used with related tools such as the Swagger Editor.
Note: Use Progress Developer Studio for OpenEdge to create an OpenEdge Data Service with a catalog file. See the following document for information on how to create one:
Requirements
- Recent version of Node.js and NPM
Installation
unzip genoas.zip
cd genoas
npm install
Usage
genoas [file | url] [OPTION]...
genoas [file | url] [--host host] [--title title] [--desc description] [--version version]
OPTIONS:
--host host
--title title
--desc description
--version version
--format ( yaml | json )
--target ( 3.0.0 | 2.0 )
Example
1. Run genoas command for a catalog.json file:
genoas http://oemobiledemo.progress.com/OEMobileDemoServices/static/SportsService.json
genoas SportsService.json --host http://oemobiledemo.progress.com/OEMobileDemoServices
This step generates the specification into a file with extension .yaml.
2. Access Swagger Editor and import the generated oas.yaml file.
3. Review the API and try invoking an operation, for example, a GET operation.
Notes:
* Swagger Editor for OpenAPI 2.0 is available at http://editor2.swagger.io
* The latest Swagger Editor can be run using Docker:
* https://hub.docker.com/r/swaggerapi/swagger-editor/
- https://swagger.io/docs/specification/2-0/basic-structure/
Swagger Editor showing generated spec
- OpenAPI Specification and Swagger:
- OpenEdge Data Service:
To generate API clients, server stubs, documentations and more, you may consider using OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator) as well. It can be installed with a single command:
npm install @openapitools/openapi-generator-cli -g
Ref: https://www.npmjs.com/package/@openapitools/openapi-generator-cli
Hope this helps.