Skip to content

Commit 8a4d8a0

Browse files
committed
固定値のswagger設定追加,jsonファイル生成追加
1 parent 2ab2bf0 commit 8a4d8a0

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

generate_api_doc.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import yaml
2+
import json
23
import re
34
import codecs
45
from collections import OrderedDict
@@ -38,6 +39,18 @@ def prepare_api_doc():
3839
if 'delete' in output_json['paths'][path].keys():
3940
del output_json['paths'][path]['delete']['x-amazon-apigateway-integration']
4041

42+
# 固定値の項目を挿入する
43+
output_json['info']['title'] = 'alisapi'
44+
output_json['basePath'] = '/api'
45+
output_json['host'] = 'alis.to'
46+
print('api-docsのバージョンを入力してください')
47+
version = input()
48+
output_json['info']['version'] = str(version)
49+
50+
# jsonファイル作成
51+
f = open('alis_api.json', 'w')
52+
json.dump(output_json, f, ensure_ascii=False, indent=2)
53+
4154
# 整形したPythonオブジェクトをyamlに変換
4255
with codecs.open('alis_api.yaml', 'w', 'utf-8') as f:
4356
yaml.dump(output_json, f, encoding='utf-8', allow_unicode=True, default_flow_style=False)

0 commit comments

Comments
 (0)