openapi: Remove a few "buggy" endpoints in the validation test.

By importing a few view modules in the validation test itself we
can remove a few endpoints which were marked as buggy. What was
happening was that the view functions weren't imported and hence
the arguments map was not filled. Thus the test complained that
there was documentation for request parameters that seemed to be
missing in the code. Also, for the events register endpoint, we
have renamed one of the documented request parameters from
"stream" to "topic" (the API itself was not modified though).

We add a new "documentation_pending" attribute to req variables
so that any arguments not currently documented but should be
documented can be properly accounted for.
This commit is contained in:
Hemanth V. Alluri
2019-07-04 11:45:10 +05:30
committed by Tim Abbott
parent c8b6afdca8
commit 2738b09044
6 changed files with 30 additions and 17 deletions

View File

@@ -68,6 +68,7 @@ class REQ:
str_validator: Callable[[Any], Any]=None,
argument_type: str=None, type: Type=None,
intentionally_undocumented=False,
documentation_pending=False,
aliases: Optional[List[str]]=None) -> None:
"""whence: the name of the request variable that should be used
for this parameter. Defaults to a request variable of the
@@ -105,6 +106,7 @@ class REQ:
self.argument_type = argument_type
self.aliases = aliases
self.intentionally_undocumented = intentionally_undocumented
self.documentation_pending = documentation_pending
if converter and (validator or str_validator):
# Not user-facing, so shouldn't be tagged for translation
@@ -155,7 +157,7 @@ def has_request_variables(view_func: ViewFuncT) -> ViewFuncT:
# Record arguments that should be documented so that our
# automated OpenAPI docs tests can compare these against the code.
if not value.intentionally_undocumented:
if not value.intentionally_undocumented and not value.documentation_pending:
arguments_map[view_func_full_name].append(value.post_var_name)
@wraps(view_func)