What is the definition of an API?
For this coding exercise, represent an API contract as a dictionary and validate its required fields. Implement the function below to return True only when the contract contains a non-empty method, a path beginning with /, and a non-empty response_type. The method must be one of GET, POST, PUT, PATCH, or DELETE.
Input: one dictionary. Output: a boolean.
contract is expected to be a dictionary, but invalid input types may be tested.GET, POST, PUT, PATCH, or DELETE./.def is_valid_api_contract(contract):