flask_restx_marshmallow.type
¤
Type hints for flask_restx_marshmallow.
APISpec
¤
APISpec(
title: str,
version: str,
openapi_version: str,
plugins: Sequence[BasePlugin] = (),
**options: Any,
)
Bases: APISpec
Stores metadata that describes a RESTful API using the OpenAPI specification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
API title |
required |
|
str
|
API version |
required |
|
Iterable[Plugin]
|
Plugin instances. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject |
()
|
|
str
|
OpenAPI Specification version. Should be in the form '2.x' or '3.x.x' to comply with the OpenAPI standard. |
required |
|
Any
|
Optional top-level keys See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object |
{}
|
Stores metadata that describes a RESTful API using the OpenAPI specification.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
API title |
required |
|
str
|
API version |
required |
|
Iterable[Plugin]
|
Plugin instances. See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#infoObject. |
()
|
|
str
|
OpenAPI Specification version. Should be in the form '2.x' or '3.x.x' to comply with the OpenAPI standard. |
required |
|
Any
|
Optional top-level keys See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#openapi-object |
{}
|
Source code in flask_restx_marshmallow/type.py
865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
|
APISpecComponents
¤
Bases: Components
Stores components that describe objects used in the API.
ApiInitAPPKwargs
¤
Bases: TypedDict
Api init_app kwargs.
ApiInitKwargs
¤
Bases: TypedDict
Api init kwargs.
Apidoc
¤
Bases: TypedDict
apidoc values.
ClassSchemaKwargs
¤
Bases: TypedDict
Class schema kwargs.
Components
¤
Bases: TypedDict
components object.
Contact
¤
Bases: TypedDict
contact object.
Discriminator
¤
Bases: TypedDict
discriminator object.
Encoding
¤
Bases: TypedDict
encoding object.
Error
dataclass
¤
Error(
code: ResponseCode = ERROR,
message: str | Mapping[str, list[str]] | None = None,
)
error response.
Source code in flask_restx_marshmallow/type.py
197 198 199 200 201 202 |
|
__new__
¤
__new__(
code: ResponseCode = ERROR,
message: str | Mapping[str, list[str]] | None = None,
) -> _Error
Error response.
Source code in flask_restx_marshmallow/type.py
184 185 186 187 188 189 190 191 192 193 |
|
Example
¤
Bases: TypedDict
example object.
ExternalDocs
¤
Bases: TypedDict
External Documentation Object.
FieldLocations
¤
Bases: NamedTuple
Non-body Field Locations.
GenericParameters
¤
GenericParameters(
*,
location: Location
| Literal[
"query",
"header",
"formData",
"body",
"cookie",
"path",
]
| None = None,
**kwargs: Unpack[SchemaInitKwargs],
)
Bases: Parameters
Generic parameters.
Base Parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Location
|
location of the parameters. Defaults to None. |
None
|
|
dict
|
other key word arguments. |
{}
|
Source code in flask_restx_marshmallow/parameter.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
Meta
¤
Meta for Parameters.
__contains__
¤
__contains__(field: str) -> bool
Whether field in self.fields.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
field name |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
whether field in self.fields |
Source code in flask_restx_marshmallow/parameter.py
96 97 98 99 100 101 102 103 104 105 |
|
__or__
¤
__or__(other: Parameters) -> Parameters
Combine two schemas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Self
|
other schema |
required |
Returns:
Name | Type | Description |
---|---|---|
Self |
Parameters
|
combined schema |
Source code in flask_restx_marshmallow/parameter.py
157 158 159 160 161 162 163 164 165 166 167 168 |
|
__setitem__
¤
__setitem__(key: str, value: Field) -> None
Set item.
Source code in flask_restx_marshmallow/parameter.py
116 117 118 |
|
combine
¤
combine(other: Parameters) -> Parameters
Combine two schemas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Self
|
other schema |
required |
Returns:
Name | Type | Description |
---|---|---|
Self |
Parameters
|
combined schema |
Source code in flask_restx_marshmallow/parameter.py
144 145 146 147 148 149 150 151 152 153 154 155 |
|
copy_body_fields
¤
copy_body_fields() -> Parameters
Return a copy of this schema with only fields that location is body.
Source code in flask_restx_marshmallow/parameter.py
120 121 122 123 124 125 126 127 128 129 130 |
|
copy_form_fields
¤
copy_form_fields() -> Parameters
Return a copy of this schema with only fields that location is formdata.
Source code in flask_restx_marshmallow/parameter.py
132 133 134 135 136 137 138 139 140 141 142 |
|
field_locations
¤
field_locations() -> list[FieldLocations]
Get (field_name, location, is_multiple) for each non-body field.
Returns:
Type | Description |
---|---|
list[FieldLocations]
|
list[FieldLocations]: field name, location, is multiple |
Source code in flask_restx_marshmallow/parameter.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
items
¤
items() -> Iterable[tuple[str, dict]]
Make dict.
Yields:
Type | Description |
---|---|
Iterable[tuple[str, dict]]
|
tuple[str, dict]: field name and field dict |
Source code in flask_restx_marshmallow/parameter.py
107 108 109 110 111 112 113 114 |
|
locations
¤
locations() -> set[str]
Get locations.
Returns:
Type | Description |
---|---|
set[str]
|
set[str]: locations |
Source code in flask_restx_marshmallow/parameter.py
67 68 69 70 71 72 73 74 75 76 77 |
|
Header
¤
Bases: TypedDict
header object.
HttpSecurityScheme
¤
Bases: TypedDict
http security scheme object.
Info
¤
Bases: TypedDict
info object.
License
¤
Bases: TypedDict
license object.
Link
¤
Bases: TypedDict
link object.
MarshmallowPlugin
¤
Bases: MarshmallowPlugin
APISpec plugin for translating marshmallow schemas to OpenAPI format.
MediaType
¤
Bases: TypedDict
mediaType object.
MutualTLSSecurityScheme
¤
Bases: TypedDict
mutualTLS security scheme object.
OAuth2SecurityScheme
¤
Bases: TypedDict
oauth2 security scheme object.
OAuthFlow
¤
Bases: TypedDict
oauth flow object.
OAuthFlows
¤
Bases: TypedDict
oauth flows object.
OneOf
¤
Bases: TypedDict
oneOf object.
OpenAPI
¤
Bases: TypedDict
openapi object.
OpenAPIConverter
¤
Bases: OpenAPIConverter
Patched OpenAPIConverter.
Adds methods for generating OpenAPI specification from marshmallow schemas and fields.
OpenIdConnectSecurityScheme
¤
Bases: TypedDict
openIdConnect security scheme object.
Operation
¤
Bases: TypedDict
operation object.
RequestBody
¤
Bases: TypedDict
requestBody object.
ResourceRoute
¤
Bases: NamedTuple
Resource route.
Result
¤
Result(items: list[T], total: int)
Bases: TypedDict
data.
Source code in flask_restx_marshmallow/type.py
114 115 |
|
SchemaInitKwargs
¤
Bases: TypedDict
Schema init kwargs.
Server
¤
Bases: TypedDict
server object.
Success
dataclass
¤
Success(
code: ResponseCode = SUCCESS,
message: str | None = None,
result: Result[T] | T | None = None,
)
success response.
Source code in flask_restx_marshmallow/type.py
161 162 163 164 165 166 167 |
|
__new__
¤
__new__(
code: ResponseCode = SUCCESS,
message: str | None = None,
result: Result[T] | T | None = None,
) -> _Success[T]
Success response.
Source code in flask_restx_marshmallow/type.py
146 147 148 149 150 151 152 153 154 155 156 157 |
|
SwaggerResponse
¤
Bases: TypedDict
response object.
Tag
¤
Bases: TypedDict
tag object.
TupleResponse
¤
Bases: NamedTuple
tuple response.
Variable
¤
Bases: TypedDict
server variable object.
Warn
dataclass
¤
Warn(
code: ResponseCode = WARNING, message: str | None = None
)
warning response.
Source code in flask_restx_marshmallow/type.py
232 233 234 235 236 237 |
|
__new__
¤
__new__(
code: ResponseCode = WARNING, message: str | None = None
) -> _Warn
Warning response.
Source code in flask_restx_marshmallow/type.py
219 220 221 222 223 224 225 226 227 228 |
|
Xml
¤
Bases: TypedDict
xml object.
filter_none
¤
filter_none(data: Mapping) -> dict
Filter None values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Mapping
|
data |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
filtered data |
Source code in flask_restx_marshmallow/type.py
118 119 120 121 122 123 124 125 126 127 |
|