Skip to content

MDRest4i SDK

MDRest4i Software Development Kit (SDK) provides automation for building and documenting REST Provider and Consumer programs.

It is a web application that is hosted on the IBM i with all of the extraction, parsing, generation and data being executed/stored on the IBM i via REST API's, built using MDRFRAME.

Info

This section provides an overview on the MDRest4i SDK. Specific details about each screen are available as online help from within the UI itself by selecting the "?" icon on any given page.

The main parts of the SDK are as follows:

SDK Web UI

A graphical, form-based web UI hosted from the IBM i HTTP server. Simplifies the editing of SWAGGER definitions, used to generate Consumer and Provider programs in RPG/COBOL. SWAGGER editor and SWAGGER UI are embedded in the SDK UI, which provides a rich set of additional validation and testing capabilities to the SDK.

Form-based editing in the SDK UI

Form-based editing in the SDK UI

SWAGGER/OAPi

Consumer and Provider definitions are edited via the web UI and submitted to the REST API code generator.

SWAGGER definitions can be edited from basic templates provided in the SDK, imported from externally created SWAGGER/OAPI docs, or imported from POSTMAN collections.

Extensions to SWAGGER are used by the SDK to specify information needed by the code generators, such as objects names, IBM i field attributes, parsing methods, etc... below is an example of the main MDRGenoptions extension added to the SWAGGER definition by the SDK:

x-mdrGen:
  RESTtype: provider
  genTemplate: RPGLE_EACH
  language: RPGLE
  jwt: 'N'
  mdrGenOptions:
    post:
      object: /QSYS.LIB/MDRTST14.LIB/api0077.PGM
      source: /QSYS.LIB/MDRTST14.LIB/TUTORIALS.FILE/api0077.MBR
      copybookPath: ''
      lastmdrGen: '2024-03-07T06:42:48.541Z'
      payloads:
        format: JSON
        parseMethod: DATA-INTO
        genMethod: DATA-GEN
        parseIntoFormat: UTF-8

SWAGGER Schema Extractors

A set of ILE REST API's called by the web UI of via IBM i commands, that generate the SWAGGER schemas and merge them into the Consumer/Provider SWAGGER definitions.

Automated SWAGGER Schema Extraction

Automated SWAGGER Schema Extraction


Consumer & Provider Generators

A Rest API and ILE generator plugins, that accept SWAGGER from the SDK web UI, and generate RPGLE or COBOL code as Consumer or Provider programs.

The SDK web UI provides the user with Consumer or Provider SWAGGER(OAPI) templates


SDK User Management

Info

SDK Portal Users and SDK Console users are shared.

SDK Users have a "User Class" assigned to them. SDK users must exist as IBM i users, before registering. No special IBM i authority is required for an SDK user

The MDRST/MDRSDKINS installation command requires a user name (ADMPRF) to use as the default SDK Administrator.

This user can be used to login to the SDK Web UI for the first time.

New users can then use the "Sign Up " option at the SDK Login screen.

New users must then be authorized by an Admin level user, after registering. This is accomplished via the SDK Site Admin - Manage Users section, clicking on the locked padlock icon, to "unlock" the user.

SDK Web UI Login

SDK Web UI Login

Site Admin, Manage Users UI

SDK Web UI Login

SDK Data Flow

MDRest4i SDK produces several artifacts:

  • SDK OpenAPI Specification as JSON
  • Generated source code - compiled into objects
  • Business documentation

alt text

The diagram below explains how the OAPI Specification and related data is stored in SDK Library

MDRest4i SDK OAPI Data Flow

MDRest4i SDK Data Flow

The primary function of MDRest4i SDK is to generate RPG or COBOL source code from OpenAPI (aka SWAGGER), and compile this source in a library of the users choice.

These generated/compiled RPG/COBOL members and objects can then be managed as normal using MDCMS, or any SCM tool of your preference.

SDK OpenAPI Specification

The "OpenAPI specification as JSON" is stored in a CLOB field (OAPIJSON) in the table MDRST/MDRDOAPI.

The primary keys of MDRDOAPI table are:

Key Description
ENTITY The name given to the specification by the user with spaces. e.g. a-client-list
USERNAME The user ID of the user who created the specification.

In descriptive terms: the same entity can be saved by multiple users.

Generated Source Code

This source code generated in either an IFS file or a PF-SRC member.

The SDK also compiles the source generated into the library selected by the user.

If requested, the source code may be create externalized copybooks that contain the data structures used for JSON schemas.

Business Documentation

MDRest4i SDK can auto-generate and publish markdown documents from the OpenAPI spec.

This artefact contains both a markdown document, and the OAPI specification used to generate the business documentation markdown code.

Both are saved as CLOB fields into the table: MDRST/MDRDPAGE.

The fields in MDRDPAGE table are:

Field Description
ENVREFUUID
Primary Key
A unique identifier for an environment in MDRest4i SDK e.g. apis-qa-env
ENTITY
Primary Key
The user ID of the user who created the specification.
In descriptive terms: an entity can be in multiple environments, but only occur once in a given environment.
OAPIREFUUID Entity identifier as per MDRDOAPI entity
PAGETYPE Specifies what the purpose of this record is:
OAPI, DOCUROOT, ENVROOT, *PAGE
MARKDOWN CLOB field that contains business documentation markdown
OAPIJSON CLOB field that contains OAPI JSON
ISPRIVATE 1 or 0
1 = must be logged in to view
UPDATED Last updated timestamp
TITLE OAPI Title
STATUS Future usage for unpublished but editable
INSTDATE MDCMS RFP Installation Date
RFPNBR MDCMS RFP Number
USER MDCMS Username
APP MDCMS Application
LVL MDCMS Level
PROJECT MDCMS Project
TASK MDCMS Task
SUBTASK MDCMS SubTask
INSTANCE MDCMS Instance
LOCATION MDCMS Location
SEQNUMBER Sequence number used when MARKDOWN/OAPI CLOBS are greater that 1Mb or 5Mb respectively