From c92aac64efaf56ccb7458d7684c1099503900a57 Mon Sep 17 00:00:00 2001 From: davidlm Date: Tue, 24 Oct 2023 17:00:14 -0400 Subject: [PATCH] add client context params to boto3 docs --- boto3/docs/service.py | 3 +++ tests/unit/docs/test_service.py | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/boto3/docs/service.py b/boto3/docs/service.py index cb01529ee0..39ed89b871 100644 --- a/boto3/docs/service.py +++ b/boto3/docs/service.py @@ -46,6 +46,7 @@ def __init__(self, service_name, session, root_docs_path): 'waiters', 'resources', 'examples', + 'context-params', ] self._root_docs_path = root_docs_path self._USER_GUIDE_LINK = ( @@ -69,6 +70,8 @@ def document_service(self): if self._service_resource: self.resource_section(doc_structure.get_section('resources')) self._document_examples(doc_structure.get_section('examples')) + context_params_section = doc_structure.get_section('context-params') + self.client_context_params(context_params_section) return doc_structure.flush_structure() def client_api(self, section): diff --git a/tests/unit/docs/test_service.py b/tests/unit/docs/test_service.py index 511313f0bc..a6e8ef19f8 100644 --- a/tests/unit/docs/test_service.py +++ b/tests/unit/docs/test_service.py @@ -276,3 +276,23 @@ def test_injects_examples_when_found(self): contents = service_documenter.document_service().decode('utf-8') assert 'This is an example' in contents assert 'This is for another service' not in contents + + def test_service_with_context_params(self): + self.json_model['clientContextParams'] = { + 'MyContextParam': { + 'documentation': 'This is my context param', + 'type': 'boolean', + } + } + self.setup_client_and_resource() + service_documenter = ServiceDocumenter( + 'myservice', self.session, self.root_services_path + ) + contents = service_documenter.document_service().decode('utf-8') + lines = [ + "=========================", + "Client Context Parameters", + "=========================", + "* ``my_context_param`` (boolean) - This is my context param", + ] + self.assert_contains_lines_in_order(lines, contents)