Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add client context params to boto3 docs #3911

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)