stable/scripts/openapi.py
LoveIsGrief d3d967e961
feat: Add script to print OpenAPI JSON
This will allow generating OpenAPI clients in multiple languages
 without relying on manually updating the self-written client.
2021-09-03 14:54:22 +02:00

20 lines
503 B
Python
Executable File

#!/usr/bin/env python3
import argparse
import json
from freqtrade.rpc.api_server import ApiServer
def main(indent: int):
openapi_dict = ApiServer({"api_server": {}}).get_open_api_json()
print(json.dumps(openapi_dict, indent=indent), flush=True)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Simply outputs the OpenAPI JSON of the REST API")
parser.add_argument("-i", "--indent", type=int, default=2)
args = parser.parse_args()
main(args.indent)