fl_server_api.openapi ¶
Classes:
| Name | Description |
|---|---|
BasicAuthAllowingTokenAuthInUrlScheme | A class that extends the BasicScheme to allow token authentication in the URL. |
CustomAutoSchema | A custom AutoSchema that includes the documented examples from the Docstrings in the description. |
Functions:
| Name | Description |
|---|---|
create_error_response | Create an OpenAPI error response. |
custom_preprocessing_hook | Hide the "/api/dummy/" endpoint from the OpenAPI schema. |
Attributes:
| Name | Type | Description |
|---|---|---|
error_response_403 | Generic OpenAPI 403 response. | |
error_response_404 | Generic OpenAPI 404 response. |
Attributes¶
error_response_403 module-attribute ¶
error_response_403 = create_error_response('Unauthorized', 'Unauthorized', 'Authentication credentials were not provided.', 'Do not forget to authorize first!')
Generic OpenAPI 403 response.
error_response_404 module-attribute ¶
error_response_404 = create_error_response('Not found', 'Not found', 'The server cannot find the requested resource.', 'Provide valid request data.')
Generic OpenAPI 404 response.
Classes¶
BasicAuthAllowingTokenAuthInUrlScheme ¶
Bases: BasicScheme
flowchart TD
fl_server_api.openapi.BasicAuthAllowingTokenAuthInUrlScheme[BasicAuthAllowingTokenAuthInUrlScheme]
click fl_server_api.openapi.BasicAuthAllowingTokenAuthInUrlScheme href "" "fl_server_api.openapi.BasicAuthAllowingTokenAuthInUrlScheme"
A class that extends the BasicScheme to allow token authentication in the URL.
Attributes:
| Name | Type | Description |
|---|---|---|
priority | | |
target_class | |
Source code in fl_server_api/openapi.py
CustomAutoSchema ¶
Bases: AutoSchema
flowchart TD
fl_server_api.openapi.CustomAutoSchema[CustomAutoSchema]
click fl_server_api.openapi.CustomAutoSchema href "" "fl_server_api.openapi.CustomAutoSchema"
A custom AutoSchema that includes the documented examples from the Docstrings in the description.
Methods:
| Name | Description |
|---|---|
get_description | Get the description of the view including its examples (if desired) formatted as markdown. |
get_operation_id | Get the operation ID which is the fully qualified name of the corresponding view/action/method. |
Attributes:
| Name | Type | Description |
|---|---|---|
rendering_style | Docstring rendering style. | |
show_examples | Flag to include examples in the description. |
Source code in fl_server_api/openapi.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
Attributes¶
rendering_style class-attribute instance-attribute ¶
Docstring rendering style.
show_examples class-attribute instance-attribute ¶
Flag to include examples in the description.
Functions¶
get_description ¶
Get the description of the view including its examples (if desired) formatted as markdown.
Returns:
| Name | Type | Description |
|---|---|---|
str | The description of the view as markdown. |
Source code in fl_server_api/openapi.py
get_operation_id ¶
Get the operation ID which is the fully qualified name of the corresponding view/action/method.
Returns:
| Name | Type | Description |
|---|---|---|
str | The operation ID. |
Source code in fl_server_api/openapi.py
Functions¶
create_error_response ¶
create_error_response(response_description: str | None, example_name: str, example_details: str, example_description: str | None, **example_kwargs) -> OpenApiResponse
Create an OpenAPI error response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| str | None | The description of the response. | required |
| str | The name of the example. | required |
| str | The details of the example. | required |
| str | None | The description of the example. | required |
| Additional keyword arguments for the example. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
OpenApiResponse | OpenApiResponse | The created OpenAPI response. |
- API Reference
fl_server_apiopenapi Attributes
Source code in fl_server_api/openapi.py
custom_preprocessing_hook ¶
Hide the "/api/dummy/" endpoint from the OpenAPI schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| list[tuple[str, str, str, Callable]] | The list of endpoints. | required |
Returns:
| Name | Type | Description |
|---|---|---|
Iterator | The filtered list of endpoints. |