Skip to content

Commit 06b25fe

Browse files
authored
more doc support for openapi generation (#259)
1 parent 3ef82c2 commit 06b25fe

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pytest-html = "*"
3131
pytest-cov = "*"
3232

3333
[scripts]
34+
generate = "python -m acai_aws.apigateway generate-openapi --base=acai_aws/example --handlers=tests/mocks/apigateway/openapi/**/*.py --output=tests/outputs --format=json,yml --delete"
3435
test = "python -m unittest discover"
3536
coverage = "coverage run --source acai_aws/ -m pytest tests/acai_aws --cov=acai_aws --junitxml ./coverage/reports/xunit.xml --cov-report xml:./coverage/reports/coverage.xml --html=./coverage/reports/index.html --self-contained-html --cov-report html:./coverage -p no:warnings -o log_cli=true"
3637
lint = "pylint acai_aws --recursive=y --load-plugins pylint_quotes --fail-under 10 --output-format=text:coverage/lint/report.txt,json:coverage/lint/report.json,parseable,colorized"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ DRY, configurable, declarative node library for working with Amazon Web Service
77
## Features
88
* Highly configurable apigateway internal router
99
* Openapi schema adherence for all event types
10+
* Generate OpenAPI docs from code base
1011
* Extensible and customizable middleware for validation and other tasks
1112
* DRY coding interfaces without the need of boilerplate
1213
* Ease-of-use with the [serverless framework](https://www.serverless.com/)

acai_aws/apigateway/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111

1212
def generate_openapi():
13+
print('STARTED')
14+
print('generating openapi docs...')
15+
print('validating arguments received...')
1316
inputs = InputArguments()
1417
validator = InputValidator()
1518
scanner = HandlerScanner(inputs.handlers)
@@ -18,16 +21,22 @@ def generate_openapi():
1821
writer = OpenAPIFileWriter()
1922

2023
validator.validate_arguments(inputs)
24+
print('arguments validated...')
2125
file_paths = scanner.get_handler_file_paths()
26+
print(f'scanning handlers: {inputs.handlers}...')
2227
modules = importer.get_modules_from_file_paths(file_paths, scanner.handlers_base, inputs.base)
28+
print('importing handler endpoint modules...')
2329

2430
for module in modules:
2531
generator.add_path_and_method(module)
2632

2733
if inputs.delete:
34+
print('deleting paths and methods not found in code base')
2835
generator.delete_unused_paths()
2936

37+
print(f'writing openapi doc to requested directory: {inputs.output}')
3038
writer.write_openapi(generator.doc, inputs.output, inputs.formats)
39+
print('COMPLETED')
3140

3241

3342
if __name__ == '__main__': # pragma: no cover

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
'jsonref',
2323
'jsonschema',
2424
'icecream',
25+
'pydantic',
2526
'pyyaml',
2627
'simplejson',
2728
'xmltodict'

0 commit comments

Comments
 (0)