Installing Swagger UI on z/OS

Before you begin

Install Node.js and run npm install http-server –g.

Procedure

  1. Download https://github.com/swagger-api/swagger-ui/archive/master.zip.
  2. Transfer the zip file to z/OS UNIX System Services and unzip.
  3. Copy <unpax_filepath>/doeserver/opt/doc/swagger.json to swagger-ui/dist/doe.json.
  4. Optional: For the Zowe API documentation, copy <zowe_directory>/zlux-app-server/doc/swagger/*.yaml to swagger-ui/dist.
  5. In swagger-ui/dist/index.html change url: "https://petstore.swagger.io/v2/swagger.json", to url: “doe.json",.
  6. Start Swagger UI.

Example

Sample JCL procedure
//DOESWAG  PROC                                                      
//*                                                                  
//DOESWAG EXEC PGM=BPXBATSL,REGION=0M,TIME=NOLIMIT,                  
//  PARM='PGM /bin/sh /prefix/swagger-ui/dist/swagger.sh'          
//STDOUT   DD SYSOUT=*                                               
//STDERR   DD SYSOUT=*
Sample shell script:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS='FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
export _TAG_REDIR_ERR=txt

export NODE_HOME=set to your node home
export PATH=$NODE_HOME/bin:$PATH

cd /prefix/swagger-ui/dist
echo "Starting Swagger Server"
http-server -p 12081 -c-1
Note: Modify –p if you want a different port number. -c-1 disables caching. For more information about http-server, see https://www.npmjs.com/package/http-server.