pvc-bootstrap/gen-api-doc

25 lines
682 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env python3
# gen-doc.py - Generate a Swagger JSON document for the API
# Part of the Parallel Virtual Cluster (PVC) system
from flask_swagger import swagger
import os
import sys
import json
os.environ['PVCD_CONFIG_FILE'] = "./bootstrap-daemon/pvcbootstrapd.yaml.sample"
sys.path.append('bootstrap-daemon')
import pvcbootstrapd.flaskapi as pvcbootstrapd
swagger_file = "docs/swagger.json"
swagger_data = swagger(pvcbootstrapd.app)
swagger_data['info']['version'] = "1.0"
swagger_data['info']['title'] = "PVC Bootstrap API"
swagger_data['host'] = "localhost:9999"
with open(swagger_file, 'w') as fd:
fd.write(json.dumps(swagger_data, sort_keys=True, indent=4))