Skip to content

Commit

Permalink
add client context params to boto3 docs (#3911)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlm6693 committed Oct 24, 2023
1 parent 29b1640 commit 3665c15
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions boto3/docs/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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):
Expand Down
20 changes: 20 additions & 0 deletions tests/unit/docs/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 3665c15

Please sign in to comment.