authnzerver.apischema module¶
This contains the API schema for all actions.
-
authnzerver.apischema.apply_typedef(item, typedef)[source]¶ This applies isinstance() to item based on typedef.
-
authnzerver.apischema.validate_and_get_function(request_type: str, request_payload: dict)[source]¶ Validates the request and returns the function needed to fulfill it.
Checks to see if the request_type can be found in the SCHEMA, then checks its request_payload dict to see if all items required are present and are the correct type.
Returns a 3-element tuple with the first element being the function name if successfully validates, None otherwise. The second element in the tuple is a list of missing or invalid request payload items for the request type. The third element in the tuple is a message.
-
authnzerver.apischema.validate_api_request(request_type: str, request_payload: dict)[source]¶ Validates the incoming request.
Checks to see if the request_type can be found in the schema, then checks its request_payload dict to see if all items required are present and are the correct type.
Returns a 3-element tuple with the first element being True if the request successfully validates, False otherwise. The second element in the tuple is a list of missing or invalid request payload items for the request type. The third element in the tuple is a message.