Skip to content

Commit 81d3bd6

Browse files
authored
Use rest format in docstrings (#817)
* Use rest format in docstrings We have a mix, let's sync on the one used by sphinx. * Fix * Fix a few issues * Minor tweaks * Fix
1 parent ec8a666 commit 81d3bd6

File tree

1,107 files changed

+20457
-16943
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,107 files changed

+20457
-16943
lines changed

.generator/templates/api.mustache

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -171,48 +171,49 @@ class {{classname}}(object):
171171
>>> thread = api.{{operationId}}({{#requiredParams}}{{^defaultValue}}{{paramName}}, {{/defaultValue}}{{/requiredParams}}{{#requiredParams}}{{#defaultValue}}{{paramName}}={{{defaultValue}}}, {{/defaultValue}}{{/requiredParams}}async_req=True)
172172
>>> result = thread.get()
173173
{{#requiredParams}}
174-
{{#-last}}
175174

176-
Args:
177-
{{/-last}}
178175
{{/requiredParams}}
179176
{{#requiredParams}}
180-
{{^defaultValue}}
181-
{{paramName}} ({{dataType}}):{{#description}} {{{.}}}{{/description}}
177+
{{^defaultValue}}{{#description}}
178+
:param {{paramName}}: {{{.}}}{{/description}}
179+
:type {{paramName}}: {{dataType}}
182180
{{/defaultValue}}
183181
{{/requiredParams}}
184182
{{#requiredParams}}
185-
{{#defaultValue}}
186-
{{paramName}} ({{dataType}}):{{#description}} {{{.}}}{{/description}} Defaults to {{{defaultValue}}}. Must be one of [{{{defaultValue}}}]
183+
{{#defaultValue}}{{#description}}
184+
:param {{paramName}}: {{{.}}} Defaults to {{{defaultValue}}}. Must be one of [{{{defaultValue}}}]{{/description}}
185+
:type {{paramName}}: {{dataType}}
187186
{{/defaultValue}}
188187
{{/requiredParams}}
188+
{{#optionalParams}}{{#description}}
189+
:param {{paramName}}: {{{.}}}{{#defaultValue}} If omitted the server will use the default value of {{{defaultValue}}}.{{/defaultValue}}{{/description}}
190+
:type {{paramName}}: {{dataType}}, optional
191+
{{/optionalParams}}
192+
:param _return_http_data_only: Response data without head status
193+
code and headers. Default is True.
194+
:type _return_http_data_only: bool
195+
:param _preload_content: If False, the urllib3.HTTPResponse object
196+
will be returned without reading/decoding response data.
197+
Default is True.
198+
:type _preload_content: bool
199+
:param _request_timeout: Timeout setting for this request. If one
200+
number provided, it will be total request timeout. It can also be a
201+
pair (tuple) of (connection, read) timeouts. Default is None.
202+
:type _request_timeout: float/tuple
203+
:param _check_input_type: Specifies if type checking should be done one
204+
the data sent to the server. Default is True.
205+
:type _check_input_type: bool
206+
:param _check_return_type: Specifies if type checking should be done
207+
one the data received from the server. Default is True.
208+
:type _check_return_type: bool
209+
:param _host_index: Specifies the index of the server that we want to
210+
use. Default is read from the configuration.
211+
:type _host_index: int/None
212+
:param async_req: Execute request asynchronously.
213+
:type async_req: bool
189214

190-
Keyword Args:{{#optionalParams}}
191-
{{paramName}} ({{dataType}}): [optional]{{#description}} {{{.}}}{{/description}}{{#defaultValue}} If omitted the server will use the default value of {{{defaultValue}}}.{{/defaultValue}}{{/optionalParams}}
192-
_return_http_data_only (bool): response data without head status
193-
code and headers. Default is True.
194-
_preload_content (bool): if False, the urllib3.HTTPResponse object
195-
will be returned without reading/decoding response data.
196-
Default is True.
197-
_request_timeout (float/tuple): timeout setting for this request. If one
198-
number provided, it will be total request timeout. It can also
199-
be a pair (tuple) of (connection, read) timeouts.
200-
Default is None.
201-
_check_input_type (bool): specifies if type checking
202-
should be done one the data sent to the server.
203-
Default is True.
204-
_check_return_type (bool): specifies if type checking
205-
should be done one the data received from the server.
206-
Default is True.
207-
_host_index (int/None): specifies the index of the server
208-
that we want to use.
209-
Default is read from the configuration.
210-
async_req (bool): execute request asynchronously
211-
212-
Returns:
213-
{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
214-
If the method is called asynchronously, returns the request
215-
thread.
215+
:return: If the method is called asynchronously, returns the request thread.
216+
:rtype: {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}None{{/returnType}}
216217
"""
217218
kwargs = self._{{operationId}}_endpoint.default_arguments(kwargs)
218219
{{#requiredParams}}

.generator/templates/api_client.mustache

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ class ApiClient(object):
4747
Ref: https://openapi-generator.tech
4848
Do not edit the class manually.
4949

50-
:param configuration: .Configuration object for this client
51-
:param header_name: a header to pass when making calls to the API.
52-
:param header_value: a header value to pass when making calls to
50+
:param configuration: Configuration object for this client
51+
:param header_name: A header to pass when making calls to the API.
52+
:param header_value: A header value to pass when making calls to
5353
the API.
54-
:param cookie: a cookie to include in the header when making calls
55-
to the API
54+
:param cookie: A cookie to include in the header when making calls
55+
to the API.
5656
:param pool_threads: The number of threads to use for async requests
5757
to the API. More threads means more concurrent API requests.
5858
"""
@@ -177,10 +177,11 @@ class ApiClient(object):
177177
{{/tornado}}
178178

179179
def parameters_to_multipart(self, params, collection_types):
180-
"""Get parameters as list of tuples, formatting as json if value is collection_types
180+
"""Get parameters as list of tuples, formatting as json if value is collection_types.
181+
182+
:param params: Parameters as list of two-tuples.
183+
:param collection_types: Parameter collection types.
181184

182-
:param params: Parameters as list of two-tuples
183-
:param dict collection_types: Parameter collection types
184185
:return: Parameters as list of tuple or urllib3.fields.RequestField
185186
"""
186187
new_params = []
@@ -198,15 +199,15 @@ class ApiClient(object):
198199

199200
@classmethod
200201
def sanitize_for_serialization(cls, obj):
201-
"""Prepares data for transmission before it is sent with the rest client
202+
"""Prepares data for transmission before it is sent with the rest client.
202203
If obj is None, return None.
203204
If obj is str, int, long, float, bool, return directly.
204-
If obj is datetime.datetime, datetime.date
205-
convert to string in iso8601 format.
205+
If obj is datetime.datetime, datetime.date convert to string in iso8601 format.
206206
If obj is list, sanitize each element in the list.
207207
If obj is dict, return the dict.
208208
If obj is OpenAPI model, return the properties dict.
209-
If obj is io.IOBase, return the bytes
209+
If obj is io.IOBase, return the bytes.
210+
210211
:param obj: The data to serialize.
211212
:return: The serialized form of data.
212213
"""
@@ -616,29 +617,32 @@ class AsyncApiClient(ApiClient):
616617
class Endpoint(object):
617618
def __init__(self, settings=None, params_map=None,
618619
headers_map=None, api_client=None):
619-
"""Creates an endpoint
620-
621-
Args:
622-
settings (dict): see below key value pairs
623-
'response_type' (tuple/None): response type
624-
'auth' (list): a list of auth type keys
625-
'endpoint_path' (str): the endpoint path
626-
'operation_id' (str): endpoint string identifier
627-
'http_method' (str): POST/PUT/PATCH/GET etc
628-
'servers' (list): list of str servers that this endpoint is at
629-
params_map (dict): see below key value pairs
630-
'required' (bool): whether the parameter is required
631-
'nullable' (bool): whether the parameter is nullable
632-
'validations' (dict): the validations dictionaries
633-
'allowed_values' (dict): the allowed values (enum) dictionaries
634-
'openapi_types' (dict): param_name to openapi type
635-
'attribute' (str): camelCase name
636-
'location' (str): 'body', 'file', 'form', 'header', 'path', 'query'
637-
'collection_format' (str): `csv` etc.
638-
headers_map (dict): see below key value pairs
639-
'accept' (list): list of Accept header strings
640-
'content_type' (list): list of Content-Type header strings
641-
api_client (ApiClient) api client instance
620+
"""Creates an endpoint.
621+
622+
:param settings: See below key value pairs:
623+
'response_type' (tuple/None): response type
624+
'auth' (list): a list of auth type keys
625+
'endpoint_path' (str): the endpoint path
626+
'operation_id' (str): endpoint string identifier
627+
'http_method' (str): POST/PUT/PATCH/GET etc
628+
'servers' (list): list of str servers that this endpoint is at
629+
:type settings: dict
630+
:param params_map: See below key value pairs:
631+
'required' (bool): whether the parameter is required
632+
'nullable' (bool): whether the parameter is nullable
633+
'validations' (dict): the validations dictionaries
634+
'allowed_values' (dict): the allowed values (enum) dictionaries
635+
'openapi_types' (dict): param_name to openapi type
636+
'attribute' (str): camelCase name
637+
'location' (str): 'body', 'file', 'form', 'header', 'path', 'query'
638+
'collection_format' (str): `csv` etc.
639+
:type params_map: dict
640+
:param headers_map: See below key value pairs:
641+
'accept' (list): list of Accept header strings
642+
'content_type' (list): list of Content-Type header strings
643+
:type headers_map: dict
644+
:param api_client API client instance.
645+
:type api_client: ApiClient
642646
"""
643647
self.settings = settings
644648
self.params_map = params_map

0 commit comments

Comments
 (0)