diff --git a/20210415101633-openapi_test_coverage.org b/20210415101633-openapi_test_coverage.org new file mode 100644 index 0000000..eaea43a --- /dev/null +++ b/20210415101633-openapi_test_coverage.org @@ -0,0 +1,45 @@ +#+title: OpenAPI Test Coverage + +Reporting coverage of OpenAPI request and response specifications using [[file:20210415110902-tornado_openapi_3.org][Tornado +OpenAPI 3]]. + +* Things that can be covered +- Requests by path and operation +- Responses by code +- Schemas? + +* Writing a Python coverage plugin +- [[https://coverage.readthedocs.io/en/coverage-5.5/api_plugin.html#api-plugin][Plug-in classes]] + +Traced files can be determined dynamically based on execution frames ([[https://docs.python.org/3/library/inspect.html][frame +objects]] are passed to plugin functions). This means I'll be able to create +simplified file-like representations of OpenAPI specifications, marking lines of +them as executable, and reporting on which ones should be marked as executed +based on the how the validator was run. + +#+CAPTION: Plugin WIP +#+begin_src python + import coverage.plugin + + + class OpenAPITemplatePlugin(coverage.plugin.CoveragePlugin, coverage.plugin.FileTracer): + def __init__(self): + self.specs = {} + + def sys_info(self): + return [("hi", "mom")] + + def file_tracer(self, filename): + return None + + def has_dynamic_source_filename(): + return True + + def dynamic_source_filename(self, filename, frame): + # TODO: Find calls to RequestValidator.validate + return None + + + def coverage_init(reg, options): + ... +#+end_src diff --git a/20210415110902-tornado_openapi_3.org b/20210415110902-tornado_openapi_3.org new file mode 100644 index 0000000..d4e22e9 --- /dev/null +++ b/20210415110902-tornado_openapi_3.org @@ -0,0 +1,5 @@ +#+title: Tornado OpenAPI 3 +#+roam_key: https://tornado-openapi3.readthedocs.io/ + +A library providing API specification validation to [[https://www.tornadoweb.org/][Tornado]] applications using +[[file:20210226114112-openapi_core.org][OpenAPI Core]].