flask_openapi.utils¶
This module contains some utility functions.
-
flask_openapi.utils.
add_optional
(data, key, value)¶ Add a value to the data dict, but only if the value is not None.
Parameters:
-
flask_openapi.utils.
parse_contact_string
(string)¶ Convert a contact string to a matching dict.
The contact string must be in the format:
name <email> (url)
email and url are optional.
Example:
>>> r = parse_contact_string('Me <me@example.com> (http://example.com/me)') >>> assert r == { ... 'name': 'Me', ... 'email': 'me@example.com', ... 'url': 'http://example.com/me' ... }
Parameters: string (str) – The string to extract the contact information from. Returns: A dict which holds the extracted contact information. Return type: dict